Author Topic: Open source optimized PTS CPU miner (BETA)  (Read 18002 times)

0 Members and 1 Guest are viewing this topic.

Offline gordonhucn

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #15 on: January 15, 2014, 01:06:24 am »
great works, can you add ypool support(from the official jhProtominer v0.1e) to it?
btw. according to intel, avx can do two sha512 and avx2 can do four at the same time~~

Offline dga

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #16 on: January 15, 2014, 06:10:52 am »
great works, can you add ypool support(from the official jhProtominer v0.1e) to it?
btw. according to intel, avx can do two sha512 and avx2 can do four at the same time~~

Going to work on it.  I'm having more fun with the algorithms than with the stuff around it - patches accepted to be able to support either pool. :-)

Speaking of avx2, I've been targeting it a little in a build I'm working on.  If people want to test it, there's a linux binary-only build available for avx2 CPUs at:

http://www.cs.cmu.edu/~dga/ptsminer-dga-adv-avx2-linux64.bin

I'll be releasing the code for this series once I've finished ironing out the kinks, but I'd be curious to know if people are seeing the same kind of speed gains that I am on their Intel Haswell-based systems.  On mine - a stock i7-4770 running at normal clock rates - I see:

[STATS] 2014-Jan-15 01:09:04 | 356.8 c/m | 5.5 sh/m | VL: 1195 (98.6%), RJ: 17 (1.4%), ST: 0 (0.0%)

Because it's a preview dev build, I changed the mining fee a little - it's higher just for this one - 5% - but in big blocks (200 seconds dev and then 4000 seconds user) so that it has more time to stabilize so you can see the true cpm rate.

I believe this one substantially outperforms yam, but only for avx2.  I'd be curious if others can confirm.

  -Dave

Offline allano

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #17 on: January 15, 2014, 07:15:12 am »
I have Ubuntu 12.04

I've done the following

sudo apt-get install build-essential libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev zlib1g-dev yasm

git clone https://github.com/dave-andersen/ptsminer

cd ptsminer/src

make -f makefile.unix.no-chrono


Code: [Select]
g++ -Wl,-z,relro -Wl,-z,now  -o ptsminer  obj/cpuid.o obj/sha512_avx.o obj/sha512_sse4.o obj/sha512.o obj/sph_sha2.o obj/sph_sha2big.o obj/main_poolminer.o  -Wl,-Bdynamic -l boost_system -l boost_filesystem -l boost_program_options -l boost_thread -Wl,-Bdynamic -l z -l dl -l pthread
obj/sha512.o: In function `Init_SHA512_avx2':
sha512.c:(.text+0x27): undefined reference to `sha512_transform_rorx'
sha512.c:(.text+0x32): undefined reference to `sha512_transform_single_rorx'
collect2: ld returned 1 exit status
make: *** [ptsminer] Error 1

I hope you can help me.

Edit:
I have fixed the Problem

sudo aptitude install libboost-system1.48-dev libboost-filesystem1.48-dev libboost-program-options1.48-dev libboost-thread1.48-dev libboost-chrono1.48-dev

 make -f makefile.unix


« Last Edit: January 15, 2014, 07:52:21 am by allano »

Offline gordonhucn

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #18 on: January 15, 2014, 09:18:21 am »
great works, can you add ypool support(from the official jhProtominer v0.1e) to it?
btw. according to intel, avx can do two sha512 and avx2 can do four at the same time~~

Going to work on it.  I'm having more fun with the algorithms than with the stuff around it - patches accepted to be able to support either pool. :-)

Speaking of avx2, I've been targeting it a little in a build I'm working on.  If people want to test it, there's a linux binary-only build available for avx2 CPUs at:

http://www.cs.cmu.edu/~dga/ptsminer-dga-adv-avx2-linux64.bin

I'll be releasing the code for this series once I've finished ironing out the kinks, but I'd be curious to know if people are seeing the same kind of speed gains that I am on their Intel Haswell-based systems.  On mine - a stock i7-4770 running at normal clock rates - I see:

[STATS] 2014-Jan-15 01:09:04 | 356.8 c/m | 5.5 sh/m | VL: 1195 (98.6%), RJ: 17 (1.4%), ST: 0 (0.0%)

Because it's a preview dev build, I changed the mining fee a little - it's higher just for this one - 5% - but in big blocks (200 seconds dev and then 4000 seconds user) so that it has more time to stabilize so you can see the true cpm rate.

I believe this one substantially outperforms yam, but only for avx2.  I'd be curious if others can confirm.

  -Dave
avx/sse performs more or less the same as x86 instruction if SIMD is not used, those bit operations(80 round calulation etc.) must be done with intel intrinsics SIMD to get a great performance boost.

Offline jernau

  • Full Member
  • ***
  • Posts: 78
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #19 on: January 15, 2014, 10:29:32 am »
Using the following CPU (Intel Xeon(R) CPU E5506  @ 2.13GHz)

Code: [Select]
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    2
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 26
Stepping:              5
CPU MHz:               2133.408
BogoMIPS:              4266.81
Hypervisor vendor:     Xen
Virtualization type:   para
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              4096K
NUMA node0 CPU(s):     0,1

Running on 2 threads, with hugepages disabled, sse4 mode, I'm getting ~50cpm vs ~35cpm for xolokram's ptsminer.
« Last Edit: January 15, 2014, 10:33:21 am by jernau »
PTS: PgiEykg2RATYwWYhFtyNRqwSxQyEApLSmW

Offline dga

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #20 on: January 15, 2014, 12:03:07 pm »
great works, can you add ypool support(from the official jhProtominer v0.1e) to it?
btw. according to intel, avx can do two sha512 and avx2 can do four at the same time~~

Speaking of avx2, I've been targeting it a little in a build I'm working on.  If people want to test it, there's a linux binary-only build available for avx2 CPUs at:

http://www.cs.cmu.edu/~dga/ptsminer-dga-adv-avx2-linux64.bin

I believe this one substantially outperforms yam, but only for avx2.  I'd be curious if others can confirm.

  -Dave
avx/sse performs more or less the same as x86 instruction if SIMD is not used, those bit operations(80 round calulation etc.) must be done with intel intrinsics SIMD to get a great performance boost.

Yes.  The reason this one is a binary-only build is that I rewrote the sha512 generating code.  It was previously using Intel's hand-optimized avx2 SIMD code.  Now it's using my own.  The binary I linked is using my own version, also SIMD using avx2, which is faster.  It's binary-only in part because I haven't made it anywhere near easy for anyone else to compile it - or made a version that is generalized across architectures.  This one is a toy for Haswell owners for now while I play with it more.

  -Dave

Offline ptsrush

  • Full Member
  • ***
  • Posts: 84
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #21 on: January 16, 2014, 01:56:54 am »
Hi Dave,

I'm running your cudapts and donating for a while and it runs great.

I'd like to try your cpu miner on my haswell machine, but it requires boost-1.53.0.

I have only boost-1.52.0 installed and a lot of software depends on it.

Of course I can upgrade to 1.53.0 and rebuild my gentoo system, but I think maybe
you could build a static linked file, so it depends only glibc.

If you do that your miner will run on almost any linux box, just as the yam did.

thank you very much.

Offline allano

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #22 on: January 16, 2014, 06:37:39 am »
Hi Dave,

I get the following error:
Code: [Select]
Could not mmap hugepage, reverting to malloc: Cannot allocate memory
Could not mmap hugepage, reverting to malloc: Cannot allocate memory
Could not mmap hugepage, reverting to malloc: Cannot allocate memory
Could not mmap hugepage, reverting to malloc: Cannot allocate memory
Could not mmap hugepage, reverting to malloc: Cannot allocate memory


I have tried the following:
Code: [Select]
echo "2048" > /proc/sys/vm/nr_hugepages
vm.nr_hugepages = 2048 in sysctl.conf
reboot

The server has the following data:
Code: [Select]
16GB RAM
AnonHugePages:         0 kB
HugePages_Total:    2048
HugePages_Free:     2048
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz

Ubuntu 12.04 64bit

I have your ptsminer compiled with makefile.unix
I start your ptsminer with ./ptsminer <adress> 8 avx

if you need more information, just tell me which


Offline honger18

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #23 on: January 16, 2014, 10:15:17 am »
I got the following trying to compile...
anyone know how to fix this ? I'm on a 32-bit kernel(PAE), not sure if that's relevant...

Code: [Select]
~/comps/ptsminer/src$ make -f makefile.unix
cc -c -O3 intel/sha512_avx2.S -o obj/sha512_avx2.o
intel/sha512_avx2.S: Assembler messages:
intel/sha512_avx2.S:64: Error: bad expression
intel/sha512_avx2.S:64: Error: junk at end of line, first unrecognized character is `y'
intel/sha512_avx2.S:67: Error: bad expression
intel/sha512_avx2.S:67: Error: junk at end of line, first unrecognized character is `y'
intel/sha512_avx2.S:70: Error: bad expression
intel/sha512_avx2.S:70: Error: junk at end of line, first unrecognized character is `r'
intel/sha512_avx2.S:72: Error: bad expression
intel/sha512_avx2.S:72: Error: junk at end of line, first unrecognized character is `r'
...
intel/sha512_avx2.S:784: Error: bad register name `%rsp)'
intel/sha512_avx2.S:785: Error: bad register name `%rsp)'
intel/sha512_avx2.S:788: Error: bad register name `%rsp)'
make: *** [obj/sha512_avx2.o] Error 1

Offline dga

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #24 on: January 16, 2014, 12:18:41 pm »
I got the following trying to compile...
anyone know how to fix this ? I'm on a 32-bit kernel(PAE), not sure if that's relevant...

Code: [Select]
~/comps/ptsminer/src$ make -f makefile.unix
cc -c -O3 intel/sha512_avx2.S -o obj/sha512_avx2.o
intel/sha512_avx2.S: Assembler messages:
intel/sha512_avx2.S:64: Error: bad expression
intel/sha512_avx2.S:64: Error: junk at end of line, first unrecognized character is `y'
intel/sha512_avx2.S:67: Error: bad expression
intel/sha512_avx2.S:67: Error: junk at end of line, first unrecognized character is `y'
intel/sha512_avx2.S:70: Error: bad expression
intel/sha512_avx2.S:70: Error: junk at end of line, first unrecognized character is `r'
intel/sha512_avx2.S:72: Error: bad expression
intel/sha512_avx2.S:72: Error: junk at end of line, first unrecognized character is `r'
...
intel/sha512_avx2.S:784: Error: bad register name `%rsp)'
intel/sha512_avx2.S:785: Error: bad register name `%rsp)'
intel/sha512_avx2.S:788: Error: bad register name `%rsp)'
make: *** [obj/sha512_avx2.o] Error 1

Are you using an older version of gcc?  If so, try upgrading -- or I can explain how to remove the need for the avx2 code if you're not on a Haswell CPU.

Offline honger18

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #25 on: January 16, 2014, 01:40:39 pm »
Hi dga
Quote
Are you using an older version of gcc?  If so, try upgrading
I have
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9)
the latest available on ubuntu. is that too old ?

Quote
or I can explain how to remove the need for the avx2 code if you're not on a Haswell CPU.

I have to admit I'm not sure if I have a HASWELL Cpu, I have the following processor.
Code: [Select]
model name      : Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid

If it's an easy fix, e.g. to comment some code out I'd appreciate it.

p.s. thanks for all the effort, I really appreciate keeping the source open !
« Last Edit: January 16, 2014, 01:48:10 pm by honger18 »

Offline fishrat

  • Full Member
  • ***
  • Posts: 50
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #26 on: January 16, 2014, 02:12:00 pm »
very good

Offline honger18

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #27 on: January 16, 2014, 02:12:30 pm »
I googled Haswell and since mine isn't one I tried commenting out the failing sha512_avx2.S bit in the makefile.unix , since apparently I can't use it anyway, but now it fails with the following. Not sure if I need to do more than mess with the makefile...


Code: [Select]
~/comps/ptsminer/src$ make -f makefile.unix
g++ -c -O3  -fpermissive -o obj/cpuid.o cpuid.c
yasm -f elf32 -o obj/sha512_avx.o intel/sha512_avx.asm
yasm -f elf32 -o obj/sha512_sse4.o intel/sha512_sse4.asm
g++ -Wl,-z,relro -Wl,-z,now  -o ptsminer  obj/cpuid.o obj/sha512_avx.o obj/sha512_sse4.o  -Wl,-Bdynamic -l boost_system -l boost_filesystem -l boost_program_options -l boost_thread -l boost_chrono -Wl,-Bdynamic -l z -l dl -l pthread
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 20 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 21 has invalid symbol index 22
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [ptsminer] Error 1

Offline daem0n

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #28 on: January 16, 2014, 02:45:16 pm »
Ubuntu 13.10 Work!  :D

1 - git clone https://github.com/dave-andersen/ptsminer

2 - sudo apt-get install build-essential libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev zlib1g-dev yasm

3 - cd ptsminer/src

4 - make -f makefile.unix

5 - ./ptsminer <address> <threads> avx

Example: ./ptsminer Padf809dfgdf9OP23nht8f02j3f0 8 avx

 8)

Offline dga

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: Open source optimized PTS CPU miner (BETA)
« Reply #29 on: January 16, 2014, 02:50:25 pm »
I googled Haswell and since mine isn't one I tried commenting out the failing sha512_avx2.S bit in the makefile.unix , since apparently I can't use it anyway, but now it fails with the following. Not sure if I need to do more than mess with the makefile...


Code: [Select]
~/comps/ptsminer/src$ make -f makefile.unix
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
make: *** [ptsminer] Error 1

Oof.  This is going to be a problem on a 32 bit system.  There are some very x86_64 specific chunks of code in the assembly-optimized sha512 routines (which you need if you want this thing to be fast).

Sorry. :(