Pages:
Author

Topic: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid) - page 7. (Read 19174 times)

legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Well lueo all good and nice except for 2 things:
1) DeathAndTaxes, tnkflx and abracadabra already mentioned (and the thread title) that they wanted a cgminer fork, not a Python version of it - and adjusting the cgminer code is required to do all the things requested - so although you may put a wrapper around cgminer, programming the 'C' changes are necessary ... and since I've already posted all that on my git ... and you've already stated you don't know 'C' very well ... um I think your missing the point that you've not done what the bounty requires
2) I've already got a response from ckolivas that he will add it into his git when it's finished

and I have above stated if any of the original people who put up the bounty say they must have JSON, then I'll add it.
(it's not difficult to add, just it seems pointless to me as I have said in a few posts as to why)
But if anyone else wants it they can add to the bounty Tongue

I will also add so you know - building a windows version of cgminer is a nightmare Smiley

Lastly - does anyone who put up the bounty disagree with what I've said?

Edit: oops Smiley I forgot to mention.
If you check my git I've just added API.java (and API.class) a java version of api-example.php since almost everyone on the planet has java on their PC (or can get it easily) that gives another way for anyone to try it out.
Usage for API.java is (as written in the top of the code)
  java API command IP port
(if any are missing or blank they are replaced with the defaults: command='summary' IP='127.0.0.1' port='4028')
Oh and IP can be a hostname or an IP address
member
Activity: 61
Merit: 10
Bitcoin believer
hero member
Activity: 742
Merit: 500
Glad to see this is coming along.  I guess plain sockets are okay instead of JSON since it isn't too difficult to parse.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
I guess they could request it with BTC Smiley
(i.e. I'd prefer to not do it - so I'd prefer if no one made a BTC request)

Of course please be specific about what you want, if you do:
i.e. JSON in and out or leave the simple input format: "command[|option]" and just use JSON out
and give a sample JSON of what you think it should be (I'll decide the format myself if you can't specify it correctly)

Of course I'll allow both if someone 'requests' with BTC coz I WAY prefer the format I'm using since it is so much easier to parse and the data being transferred is fully handled by the format I'm using and does not require a more complex JSON format.
Good Smiley No reply to that Smiley

However, with such a high bounty, I'm sorta wondering about the lack of response I see to what's already done,
since it is pretty much finished except for the socket error messages I mentioned and of course anything that anyone else wants to point out is missing or not working.

So I'll ask directly ...
* DeathAndTaxes
* Gigasvps
* Tnkflx
* abracadabra
* Red Emerald
* ThiagoCMC
* gnar1ta$
* Chefnet

Any of you got any comment or issues or requests?
(and if any of you guys specifically require the JSON format then it's no extra - but again I'm not sure why anyone would need it)

Current command set with an example (unformatted) reply is:
apiversion
 '0.3'

devs
 'STATUS=S,CODE=9,MSG=2 GPU(s) - 0 CPU(s)|GPU=0,GT=75.00,FR=3355,FP=85,EN=Y,STA=ALIVE,MHS=357.87,A=247,R=47,HW=0,U=0.35,I=9|GPU=1,GT=69.50,FR=2573,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=269,R=19,HW=0,U=0.38,I=9|'

pools
 'STATUS=S,CODE=7,MSG=1 Pool(s)|POOL=0,URL=http://0.0.0.0:0,STA=ALIVE,PRI=0,LP=N,Q=59499,A=517,R=66,DW=10071,ST=0,GF=65,RF=0|'

summary
 'STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,ST=0,GF=65,LW=0,RO=0,BC=2801|'ST=0,GF=65,LW=0,RO=0,BC=2801|'

gpudisable|0
 'STATUS=I,CODE=12,MSG=GPU 0 set disable flag|'
  In cgminer you'll see something like:
   [2011-11-30 08:28:48] Thread 2 being disabled
   [2011-11-30 08:28:48] Thread 0 being disabled

gpuenable|0
 'STATUS=I,CODE=5,MSG=GPU 0 sent enable message|'
  In cgminer you'll see something like:
   [2011-11-30 08:29:16] Thread 0 being re-enabled
   [2011-11-30 08:29:16] Thread 2 being re-enabled

gpurestart|0
 'STATUS=I,CODE=13,MSG=GPU 0 restart attempted|'
  In cgminer you'll see something like:
   [2011-11-30 08:30:31] Thread 0 still exists, killing it off
   [2011-11-30 08:30:31] Thread 2 still exists, killing it off
   [2011-11-30 08:30:31] Thread 0 restarted
   [2011-11-30 08:30:31] Thread 2 restarted

gpu|1
 'STATUS=S,CODE=17,MSG=GPU1|GPU=1,GT=69.00,FR=2575,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=271,R=19,HW=0,U=0.38,I=9|'

cpu|0 (I'm only running GPU mining so I get this error message
 'STATUS=E,CODE=16,MSG=No CPUs|'

gpucount
 'STATUS=S,CODE=20,MSG=GPU count|GPUS,COUNT=2|'

cpucount
 'STATUS=S,CODE=21,MSG=CPU count|CPUS,COUNT=0|'
member
Activity: 61
Merit: 10
Bitcoin believer
I am also designing a new GUI to control my mining machine remotely. I hate to open lots of applications to mine and monitor my mining rig.

If you have more ideas, welcome to send to me!

member
Activity: 61
Merit: 10
Bitcoin believer
I am currently working on my project for output restful JSON. The following URLs are used to retrieve the status of a mining rig.

url: /adl/devices  -> list all adl devices
url: /adl/device/  -> list the status of a device
url: /opencl/devices -> list all opencl devices (to mine!)
url: /opencl/device/ -> list the status of an opencl device
url: /miners -> list all miners on the computer
url: /miner/ -> output the status of a miner (cgminer for now. will be extended to other miners, too!)

Currently it can only display the status. I am implementing the control part (to control GPU clock, mem, start / stop miners). So the progress of this project is about 40%.

I'll release the project when the progress is about 80% so that more feedback and tests could be done.

The following is a sample output on a 6970*3 machine:
Code:
URL: GET /adl/devices
{
  "count": 3,
  "devices": [
    {
      "busNumber": 1,
      "index": 0,
      "adapterIndex": 0,
      "displayName": "\\\\.\\DISPLAY46",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&31B538E3&0&0010A",
      "adapterName": "AMD Radeon HD 6900 Series"
    },
    {
      "busNumber": 4,
      "index": 1,
      "adapterIndex": 4,
      "displayName": "\\\\.\\DISPLAY42",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&4C9C647&0&0058A",
      "adapterName": "AMD Radeon HD 6900 Series"
    },
    {
      "busNumber": 5,
      "index": 2,
      "adapterIndex": 8,
      "displayName": "\\\\.\\DISPLAY50",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&62C0392&0&0060A",
      "adapterName": "AMD Radeon HD 6900 Series"
    }
  ]
}

Also, the status of each card could be displayed remotely:
Code:
URL: GET /adl/device/0
{
  "index": 0,
  "displayName": "\\\\.\\DISPLAY46",
  "vddc": 1.175,
  "adapterName": "AMD Radeon HD 6900 Series",
  "activity": 99,
  "powertuneLevel": 20,
  "fanSpeedPercent": 100,
  "memClock": 795.0,
  "fanSpeedRPM": 7345,
  "fanSpeedUserDefine": "user-defined",
  "engineClock": 920.0,
  "performanceLevel": 2,
  "temperature": 91.5
}


Well to be honest, I did not see uhm...anything that looks like it could output JSON. Is this just sockets?
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
I guess they could request it with BTC Smiley
(i.e. I'd prefer to not do it - so I'd prefer if no one made a BTC request)

Of course please be specific about what you want, if you do:
i.e. JSON in and out or leave the simple input format: "command[|option]" and just use JSON out
and give a sample JSON of what you think it should be (I'll decide the format myself if you can't specify it correctly)

Of course I'll allow both if someone 'requests' with BTC coz I WAY prefer the format I'm using since it is so much easier to parse and the data being transferred is fully handled by the format I'm using and does not require a more complex JSON format.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Yep just a simple socket.
Look at the api-example.php
(that also shows how simple it is to interact with it)
It really is VERY easy to interact with it and doesn't require many megabytes of code and libraries to do that.
You simply send a request to the port and it sends a reply.
The format of the reply (except apiversion) is very simple also: (as stated before https://bitcointalksearch.org/topic/m.629425 )

STATUS=x,CODE=nnn,MSG=string|type[=value],name=value,name=value,name=value|

i.e. sections are separated by '|'
name/value pairs are separated by ','
and name/value has an '=' between

Where x is one of
W - warning
I - informational
S - success
E - error
F - fatal (code bug)

Each code has a unique number

If a reply returns multiple sets of data (e.g. multiple pools) then it will just be multiple "type=value,...|" sections.
e.g. POOL=0,URL=http://url.com:8223,MHS=30000.00,...|POOL=1,URL=http://url2.com:8888,MHS=10000.00,...|

You will see that if you use the php.
Run it and use the php script (just type "php api-example.php" on the same computer will do it)
If you can't put php on the miner, copy api-example.php to another PC and:
1) edit the address in it "127.0.0.1" to be the address of the miner
2) run the miner with the "--api-listen" option
If you need it in some other code - just say - I can very quickly write that in C, Java or maybe even anything else you can think of.
(the only language I know of that I haven't ever used is C# and that's coz I never will use it by choice)

Thus to convert it to a structure usable in your code (which is what you must do with json also)
is only a small amount of code (as given in the php)

the 3 separators "| , =" are currently guaranteed to be OK unless a pool puts a ',' or '|' in their URL somewhere
(no idea why a pool would use that)

If anyone is concerned about that I can change it (or all 3) to control characters (0x01, 0x02, 0x03)
But using normal characters makes the return string more easily humanly readable.

The documentation will be updated once I've covered all the requirements.

So again Smiley What's missing?
Any bugs?

(ok I've realised one thing needs to be changed that I forgot - the socket error string code is wrong on windows - it should use a different function (not errno) - I'll change that once I know something else that needs to be done)
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
Well to be honest, I did not see uhm...anything that looks like it could output JSON. Is this just sockets?
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Well after going through all the pain and agony of building a windows executable ...

It's here: https://github.com/kanoi/cgminer/downloads

I have of course already created the 2.0.8w version without GPU mining and that works fine.
I have not actually successfully run the GPU version on anything. So I do not know if that binary works. Could someone please try it.
That one is just the windows CPU version that works fine for me but with GPU support enabled.
I can't run it coz it crashes on OpenCL.dll
Though I did find OpenCL.dll online, I have no idea if that is expected if you don't have a system with an ATI card and drivers installed
(I don't have a windows system with an ATI card - my only ATI card is of course my xubuntu miner)

It also crashes on exit just like 2.0.8 windows version does ... I do have an actual idea about what is causing that (the thread shut down code) but since I didn't write that, I'm not going to look into fixing that before I finish this bounty.

The additional commands (since last time) are:
gpucount and cpucount
and this one reports the apiversion as 0.3

Now if this GPU win32 exe actually works for anyone ...

What changes are required?
What's missing?

If it runs for you and you spot any problems - of course let me know.

Edit: added a Xubuntu 2.0.8w binary also to the downloads. So that's both of them Smiley

Edit2: added the 2 free windows dll's required (again to the download tab) and updated the git source
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
If and when it's finalised, I will be merging it into my tree, and then eventually I will make a windows version from it when I release a new official version of cgminer. However I would appreciate kano fixing any windows builds before then since things inevitably break when trying to port it.
Well I'll certainly sort out any api.c problems in Windows and make sure that works Smiley
As for ADL/ATI - since I'm not changing any of that I hopefully won't cause any new problems there (crosses fingers)
(but of course once? I can make an ADL working windows binary ... I guess I can ask people to try it and report any differences)
First step to just make a CPU version that runs on windows ... I'll be back in a week or two? Cheesy (just kidding)

Edit: I guess I should go back to frequenting the #cgminer IRC channel soon ... (kanoi)
-ck
legendary
Activity: 4088
Merit: 1631
Ruu \o/
If and when it's finalised, I will be merging it into my tree, and then eventually I will make a windows version from it when I release a new official version of cgminer. However I would appreciate kano fixing any windows builds before then since things inevitably break when trying to port it.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Hmm I don't actually have a windows compiler or even a computer running windows that could compile it
(just my kids computer runs windows)
I do have a VirtualBox OSE that I run the Aus Tax/Bas programs in on this computer (but of course no ATI card)
Anyone got a link to how I'd compile a OCL/ADL program (using gcc?) on 32-bit WindowsXP for everyone? Tongue
(or some other legal free compiler on windows)

Edit: hmmm - mingw or cygwin? Have to read the cgminer thread to work out which one ckolivas was using ...

Edit2: seems to be mingw ...
sr. member
Activity: 349
Merit: 250
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
Yep adding GPU setting commands shouldn't be too hard now that I've made a pretty simple to edit interface with messages/errors and everything else reasonably simple ... at least for myself Smiley

Git (as before): https://github.com/kanoi/cgminer

OK v0.2 in the git - plus the bunch of changes I spent today adding on top of v0.2 where I tracked down a bug I caused in main.c back when I first started working on this ... yesterday ... (hint 7 <-> 8 Tongue)

The commands so far are:
apiversion - just returns a version string: 0.2
devs - returns the list of gpus and cpus - each with the full status, details, plus
pools - returns the list of pools with their status, details
summary - returns the total summary information similar to when you exit cgminer (without pool breakdown)
gpuenable|N - enable GPU N (flags and notifies the GPU to start)
gpudisable|N - disable GPU N (flags the GPU to stop)
gpurestart|N - restart GPU N
gpu|N - show the 'devs' output but just for GPU N
cpu|N - show the 'devs' output but just for CPU N
quit - quit cgminer

Each return includes a status array of:
STATUS: F (fatal) E (error) W (warning) I (info) S (success)
CODE: the internal error code: each has a unique number - see api.c MSG_ZZZZZZ
MSG: a related status message

F (fatal) only occurs when api.c fails to determine the correct error code - these mean report the output line to me to fix api.c
E (error) you made a mistake - e.g. you sent an unknown command or an invalid CPU/GPU number or those sort of mistakes
W (warning) you need to do something else first - currently only when you try to enable a GPU that's not well
I (info) nothing changed - e.g. trying to enable an enabled GPU
S (success) as expected

I've built a 2.0.8a version for xubuntu 11.04 and you can download the binary here to try it (if you can't compile):
http://tradebtc.net/cgminer2.0.8a
1,760,610 bytes, sha256sum: a96ef5ad0914b3becb059f992da93801badcea0dc946120b0199ff31ab4d7b67

Of course you'll need something like api-example.php in the git to try issuing commands to it and see the result.
Otherwise it runs exactly the same as an ADL 2.0.8 so you can use it normally also ... and I didn't even change the donation code Tongue

So ... what's missing?

Edit: I'll update the DOC files once I've done the initial set of requirements and sorted out with ckolivas about if he'll accept the commits to his git
donator
Activity: 1218
Merit: 1079
Gerald Davis
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.
Hmm - but that doesn't seem to makes sense.

The stop/start/restart request is just for a single GPU.

If your editing the config file you may as well just stop and start cgminer from scratch.
i.e. press q (or send a 'quit' command) and start it again
i.e. run it in a script that just continually loops starting it (like the script I have posted before) and tell it to quit so it starts from scratch.
If you mean a global 'restart' command, not a single GPU stop/start/restart (like quit but that starts again afterwards)
But it really is better to actually completely stop cgminer and restart it since the point of that is to clear the ATI/AMD interface and like windows, that is best done as a complete program stop/start coz ATI/AMD are not good at dealing with that ... and that would also give you all an excuse for not having to pay me too - that should make everyone happy Smiley

I'll just implement a GPU stop/start option.

Thank makes sense.  I was just thinking that by checking config file on each "restart" one could make changes even if RPC to implement changes in clock/intensity/fan were not implemented.  You are right one could simply end the daemon, change config file, and start the deamon again. 

So unless anyone else has a problem I don't think checking config on starting each GPU is needed or warranted.  It really was just a workaround.  The end goal would be for the project (maybe in later version) to allow controlling GPU via RPC (i.e. change fan 70%, change clock 800MHz, etc).
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.
Hmm - but that doesn't seem to makes sense.

The stop/start/restart request is just for a single GPU.

If your editing the config file you may as well just stop and start cgminer from scratch.
i.e. press q (or send a 'quit' command) and start it again
i.e. run it in a script that just continually loops starting it (like the script I have posted before) and tell it to quit so it starts from scratch.
If you mean a global 'restart' command, not a single GPU stop/start/restart (like quit but that starts again afterwards)
But it really is better to actually completely stop cgminer and restart it since the point of that is to clear the ATI/AMD interface and like windows, that is best done as a complete program stop/start coz ATI/AMD are not good at dealing with that ... and that would also give you all an excuse for not having to pay me too - that should make everyone happy Smiley

I'll just implement a GPU stop/start option.
full member
Activity: 154
Merit: 101
Bitcoin!
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
https://github.com/kanoi/cgminerEdit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?
Just getting the info should be safe, if done after everything is set up and all the threads started.
It's the last thread created.
But I'll check see if there's something I can check/sleep until it's ready - I guess that would be better.
(or add a variable for that exact reason)
Arigatou.

Edit: after a closer look - everything seems to be initialised before the threads are created so it should be fine.
Also now added the parameter options required:
--api-port nnn (port number to use - default 4028)
--api-listen (defaults to only listen on 127.0.0.1 for security - this boolean option means listen on 0.0.0.0)

I guess GPU/CPU enable/disable is next ...
-ck
legendary
Activity: 4088
Merit: 1631
Ruu \o/
https://github.com/kanoi/cgminerEdit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?
Just getting the info should be safe, if done after everything is set up and all the threads started.
Pages:
Jump to: