pooler / cpuminer

CPU miner for Litecoin and Bitcoin
https://bitcointalk.org/index.php?topic=55038.0
Other
2.77k stars 1.21k forks source link

Build on POWER8 AIX 7.2 #119

Closed awam closed 7 years ago

awam commented 7 years ago

Hello, I am trying to build cpuminer on AIX 7.2 Power8. I am getting the following errors during the make.

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I/usr/include/curl -I./compat/jansson -lpthread -g -O2 -MT minerd-sha2-ppc.o -MD -MP -MF .deps/minerd-sha2-ppc.Tpo -c -o minerd-sha2-ppc.o test -f 'sha2-ppc.S' || echo './'sha2-ppc.S

Assembler: /tmp//cc8PUCVE.s: line 10: 1252-016 The specified opcode or pseudo-op is not valid. Use supported instructions or pseudo-ops only. /tmp//cc8PUCVE.s: line 16: 1252-016 The specified opcode or pseudo-op is not valid. Use supported instructions or pseudo-ops only. /tmp//cc8PUCVE.s: line 42: 1252-016 The specified opcode or pseudo-op is not valid. Use supported instructions or pseudo-ops only. /tmp//cc8PUCVE.s: line 890: 1252-211 Invalid relocation type: ha. /tmp//cc8PUCVE.s: line 891: 1252-214 A TOC-relative relocation type can only be used with a TOC symbol. /tmp//cc8PUCVE.s: line 2654: 1252-016 The specified opcode or pseudo-op is not valid. Use supported instructions or pseudo-ops only. /tmp//cc8PUCVE.s: line 3303: 1252-211 Invalid relocation type: ha. /tmp//cc8PUCVE.s: line 3304: 1252-214 A TOC-relative relocation type can only be used with a TOC symbol. /tmp//cc8PUCVE.s: line 5623: 1252-211 Invalid relocation type: ha. /tmp//cc8PUCVE.s: line 5624: 1252-214 A TOC-relative relocation type can only be used with a TOC symbol.

These lines in assembly code contains .text, .data, lis and addi. Any suggestion please?

pooler commented 7 years ago

This particular code was written with PowerPC in mind, so there may be some incompatibilities. Could you please post (preferably to a pastebin) the full assembly file in question, as well as your config.log?

By the way, if you just need to get cpuminer to build, passing --disable-assembly to configure should do the trick.

awam commented 7 years ago

I have pasted the config.log here https://pastebin.com/JTamM95G and the assembly file is https://pastebin.com/UxE2mpKM

I have taken the assembly file from the git and haven't made any modifications except I ran nomacro.pl to expand macros. I did this because the assembler was complaining about .macro and .endm directives.

pooler commented 7 years ago

Thanks, but I actually meant the preprocessed assembly file that is fed to the assembler (cc8PUCVE.s in your original post), so that I can make sense of the line numbers in the errors.

awam commented 7 years ago

Preprocessed assembly file saved using -save-temps : https://pastebin.com/uFZMzzGz

pooler commented 7 years ago

OK, one more thing. Could you please post sha2.s, obtained by running gcc -S sha2.c?

awam commented 7 years ago

Here it is https://pastebin.com/iCGSQppq

pooler commented 7 years ago

I have very limited experience with this architecture, so unless you can provide me with direct access to your machine we'll have to do a bit of trial and error.

Please apply the following patch and report any errors you get.

diff --git a/sha2-ppc.S b/sha2-ppc.S
index 318fd57..888e6d0 100644
--- a/sha2-ppc.S
+++ b/sha2-ppc.S
@@ -102,3 +102,7 @@

+#ifdef _AIX
+   .csect .data[RW]
+#else
    .data
+#endif
    .align 2
@@ -108,3 +112,2 @@ sha256_h:

-   .data
    .align 2
@@ -202,3 +205,7 @@ sha256_k:

+#ifdef _AIX
+   .csect .text[PR]
+#else
    .text
+#endif
    .align 2
@@ -382,3 +389,2 @@ sha256_transform_extend:

-   .text
    .align 2
@@ -909,3 +915,7 @@ _sha256d_ms:

+#ifdef _AIX
+   .csect .data[RW]
+#else
    .data
+#endif
    .align 4
@@ -921,3 +931,2 @@ sha256_4h:

-   .data
    .align 4
@@ -989,3 +998,2 @@ sha256_4k:

-   .data
    .align 4
@@ -997,3 +1005,2 @@ sha256d_4preext2:

-   .data
    .align 4
@@ -1095,3 +1102,7 @@ br_perm:

+#ifdef _AIX
+   .csect .text[PR]
+#else
    .text
+#endif
    .align 2
@@ -1138,3 +1149,2 @@ _sha256_init_4way:

-   .text
    .align 2
@@ -1351,3 +1361,2 @@ sha256_transform_4way_extend:

-   .text
    .align 2
@@ -1912,3 +1921,2 @@ _sha256d_ms_4way:

-   .text
    .align 2
awam commented 7 years ago

How can I send you the credentials for the remote machine?

pooler commented 7 years ago

You can send me an email at (my name) at litecoinpool dot org.

jpolifka commented 7 years ago

Hi there,

any updates on this issue? cpuminer will compile with the --disable-assembly option. Compiled with gcc and AIX native make. Could also test xlc tomorrow. It's an AIX 7100-04-04 install on power8. I'm actually running with 60 Threads in SMT8 mode and getting around 110-120 kh/s.

pooler commented 7 years ago

@cheezuscraizt, check out git branch aix, it seemed to work fine on @awam's machine when I tested it. I was waiting for him to do some more testing before merging, but if you can confirm that it works I'll go ahead.

jpolifka commented 7 years ago

@pooler will try it tomorrow as I want to try it with a fresh install. Thanks for your fast reply!

jpolifka commented 7 years ago

Hi, just tried the branch Aix. It crashed during compilation of miner-sha2-ppc.o.

config.log assembly sha2-ppc.s build sha2.s

The sha2.s was build with gcc -I./compat/jansson -pthread -S sha2.c

pooler commented 7 years ago

@cheezuscraizt Did you run nomacro.pl? If the problem persists, please post the errors you get when building.

jpolifka commented 7 years ago

With no macro.pl the compilation works. Did not run it, as it is no Mac. Just running it with 60 threads, now with 140-150 kh/s.

Thanks again for your quick help! IMHO you can merge the branches.

pooler commented 7 years ago

@cheezuscraizt: thanks for pointing that out, I should update the readme. Just for curiosity's sake, what speed do you get if you compile with Altivec support (add -maltivec to CFLAGS)?

jpolifka commented 7 years ago

The first hundred shares did all with 198.41 - 198.43 kh/s. I'm using following command line: /usr/local/bin/minerd -o stratum+tcp://litecoinpool.org:8080 -O cheezuscraizt.power8:xxx -SBqt 60

The hardware is a power8 with 48 cores and 512gb ram. The virtual machine can distribute work to 40 processors out of the pool, but only if no other lpar needs any cpu resources. Aix typical is the low memory consumption, only 4gb are given to the lpar. AIX is running in SMT4 mode, so I have 160 available threads. With the configured 60 threads the machine is running with 37 fully used physical cores.

If I let minerd evaluate the number of running threads, I get following error:

[2017-06-22 12:55:45] DEBUG: job_id='3a06' extranonce2=00000000 ntime=594ba20c
[2017-06-22 12:55:45] Stratum requested work restart
[2017-06-22 12:55:45] Binding thread 204 to cpu 204
[2017-06-22 12:55:45] Binding thread 205 to cpu 205
[2017-06-22 12:55:45] scrypt buffer allocation failed

Running with 120 threads get the hash rate to 314-322 kh/s for a share. Still the hardware is not hitting the limits. It's still not a miner hardware but the effectiveness is impressive.

160 Threads equals 100% CPU usage. Hashing with 405 kh/s per share and the rate is increasing.

If you like, I can run a benchmark.

pooler commented 7 years ago

Thanks for the detailed report, it's very interesting!

I'm now going to close this issue and merge the changes.