madMAx43v3r / chia-plotter

Apache License 2.0
2.27k stars 662 forks source link

Madmax slower than Chia Official App Ubuntu 18.04 #852

Open jmgoycoolea opened 3 years ago

jmgoycoolea commented 3 years ago

Please help, I don't understand why MadMax makes the plots slower than the official Chia app. I have tried different command lines varying the buckets, assigning from 8 to 14 threads and it doesn't make much difference. I have a 1TB NVMe disk for temporary writing.

RIG: 16gb RAM Intel Core i7-10700K 3.80GHz 16 threads Ubuntu 18.04 NVMe 1TB for temp files. Chia version 1.2.2

Official Chia app time one Plot: 5 hrs. MadMax time one Plot: 6 to 7.5 hrs.

These are some command lines I used: ./chia_plot -n 1 -r 14 -u 256 -t /media/jorge/NVMe/tmp/ -d /media/jorge/WD12TB-01/MadMax/ -c xxx -f yyy

./chia_plot -n 1 -r 14 -u 256 -v 128 -t /media/jorge/NVMe/tmp/ -d /media/jorge/WD12TB-01/MadMax/ -c xxx -f yyy

Thanks in advance!!

boxter007 commented 3 years ago

I think you need to change your NVME

ataa commented 3 years ago

Monitor your swap utilization when MadMax is running. If you can, Turn off the swap, trim your nvme and try with -r 8 -u 256 -v 128 and increase bucket size if MM got killed by kernel due to out of memory.

I have i7 990x, 16GB, 1TB Samsung pm983 nvme (swap off). on 21.04, I get 56 minutes per plot using -r 7 -u 256 -v 128 -K 2

boxter007 commented 3 years ago

If you use swap and your memory is enough , you can type sudo swapoff -a .

jmgoycoolea commented 3 years ago

First of all, thank you very much for your support guys specially to ataa.

I've updated to Ubuntu 20.04 and incorporated -K 2 with 8 threads and -v 128 to the command line. Just with this, 1 plot time has reduced to 2.5 hours. Later I swaped off with "sudo swapoff -a" and Trim hdd's with "sudo fstrim -a". The result was 2 hours one plot. Final Result: When I made two or more plots after trim the disks, the first one, correspond to two hours and the rest of them, 3 hours.

I was reading about trim your disk 'permantly' will kill it soon. If you have another opinnion please share with me.

How do I trim only NVMe disk?, I don't like to use "fstrim -a".

Thanks!!

ataa commented 3 years ago

How do I trim only NVMe disk?

fstrim /mnt/nvme replace /mnt/nvme with your nvme mount point.

You can find nvme mount point by using lsblk

jmgoycoolea commented 3 years ago

lsblk

Ok got it !! To make it automaticly for example on crontab it would be like this?

sudo nano /etc/cron.hourly/trim

!/bin/sh

LOG=/Documentos/ChiaInstall/Trimlog/trim.log echo " $(date -R) " >> $LOG fstrim -v /media/jorge/NVMe / >> $LOG

sudo chmod a+x /etc/cron.hourly/trim

boxter007 commented 3 years ago

type command: lscpu ,find your CPU speed. And make sure that your CPU has been set to performance.

jmgoycoolea commented 3 years ago

type command: lscpu ,find your CPU speed. And make sure that your CPU has been set to performance. I ran lscpu but I haven't seen if the CPU is set to performance. I made it with grep . /sys/devices/system/cpu/cpufreq/policy*/scaling_governor The result was the CPU is set to porwersafe, so i made this to change it to performance: Install cpufrequtils: sudo apt-get install cpufrequtils Then edit the following file (if it doesn't exist, create it): sudo nano /etc/default/cpufrequtils And add the following line to it: GOVERNOR="performance" Save and exit. For changes take effect, run: sudo systemctl restart cpufrequtils

After setting the CPU to performance I was expecting improve the plot time, but result was the same time than before.

jmgoycoolea commented 3 years ago

Please help me with this: In order to maintain 2,5 hours per plot (minimum plot time that I reached) with your help guys. I need to trim the nvme disk hourly. I'm trying to do it by crontab, so I configured anacron to excute the following file: sudo nano /etc/cron.d/anacron @hourly 1 trimnvme /bin/bash /etc/cron.hourly/trim

"trim" file contain:

!/bin/sh

LOG=/Documentos/ChiaInstall/Trimlog/trimlog echo " $(date -R) " >> $LOG fstrim -v /media/jorge/NVMe >> $LOG

If I run manualy from the terminal with "run-parts /etc/cron.hourly" it works perfectly and the LOG output file shows: Thu, 22 Jul 2021 12:26:06 -0400 /media/jorge/NVMe: 763,3 GiB (819625492480 bytes) recortado

The problem is, when crontab is executed every hour, execute the file and the output is just Thu, 22 Jul 2021 12:00:00 -0400 , and didn't executed the command to trim the nvme disk (fstrim -v /media/jorge/NVMe >> $LOG).

I thought maybe the passwd to run fstrim is cuting the process, so I tested this: sudo visudo jorge ALL=NOPASSWD:/bin/fstrim

I verifyied crontab is running with: grep CRON /var/log/syslog Output: Jul 22 11:00:01 CHIAPROYECT CRON[33874]: (jorge) CMD (run-parts /etc/cron.hourly) Jul 22 11:00:01 CHIAPROYECT CRON[33873]: (CRON) info (No MTA installed, discarding output)

Still doesnt work!!. Please your help!!

andriusst commented 3 years ago

I am not much of a linux guy but first step to troubleshooting any kind of performance problems is to find the bottleneck. For chia plotter it will either be the disk(s) or the CPU. To monitor disks try command iostat -xmt 1 and pay attention to avgqu-sz, rMB/s and wMB/s columns. If there are any disks with average queue size that never goes below 4 and has lower than expected rMB/s or wMB/s is a potential bottleneck. To monitor the CPU try command top and look for chia_plot to see the CPU usage. You want it has high as possible up to 1600%. It will dip down and up depending on plotting stage. So perhaps keep an eye for an extended period to see how it behaves. You might also want to have lscpu | grep "MHz" running to see the CPU clock speed.

Once bottlenect identified you can then narrow your focus down to that.

Also it would be good to see your plot log file. Perhaps we'd notice something worth looking at. Here is what mine looks like. Your speeds will obviously be different but we can try and extrapolate to see if any phase or step takes unusally long to complete.

Multi-threaded pipelined Chia k32 plotter - 82f92a9 Build 0.1.2a for Windows. Check for latest updates: https://stotiks.github.io/chia-plotter/

Final Directory: x:\ Number of Plots: 1 Crafting plot 1 out of 1 Process ID: 2580 Number of Threads: 40 Number of Buckets P1: 2^8 (256) Number of Buckets P3+P4: 2^7 (128) Pool Public Key: (concealed) Farmer Public Key: (concealed) Working Directory: x:\ Working Directory 2: x:\ Plot Name: plot-k32-2021-07-20-20-56-df462328278aa77deae5448d309f14d7323ac43614250b6f87f0e59e5ea4392c [P1] Table 1 took 13.8923 sec [P1] Table 2 took 71.8714 sec, found 4294945342 matches [P1] Table 3 took 100.197 sec, found 4294879039 matches [P1] Table 4 took 120.103 sec, found 4294784599 matches [P1] Table 5 took 113.957 sec, found 4294541230 matches [P1] Table 6 took 106.396 sec, found 4294225380 matches [P1] Table 7 took 74.6335 sec, found 4293578337 matches Phase 1 took 601.205 sec [P2] max_table_size = 4294967296 [P2] Table 7 scan took 12.7154 sec [P2] Table 7 rewrite took 43.8229 sec, dropped 0 entries (0 %) [P2] Table 6 scan took 15.2312 sec [P2] Table 6 rewrite took 28.6847 sec, dropped 581320428 entries (13.5373 %) [P2] Table 5 scan took 15.0783 sec [P2] Table 5 rewrite took 28.7368 sec, dropped 762003026 entries (17.7435 %) [P2] Table 4 scan took 14.2371 sec [P2] Table 4 rewrite took 27.1235 sec, dropped 828917310 entries (19.3006 %) [P2] Table 3 scan took 14.6512 sec [P2] Table 3 rewrite took 28.4726 sec, dropped 855114969 entries (19.9101 %) [P2] Table 2 scan took 14.3267 sec [P2] Table 2 rewrite took 27.0312 sec, dropped 865613982 entries (20.1542 %) Phase 2 took 273.884 sec Wrote plot header with 268 bytes [P3-1] Table 2 took 35.6962 sec, wrote 3429331360 right entries [P3-2] Table 2 took 29.4336 sec, wrote 3429331360 left entries, 3429331360 final [P3-1] Table 3 took 35.5136 sec, wrote 3439764070 right entries [P3-2] Table 3 took 31.5238 sec, wrote 3439764070 left entries, 3439764070 final [P3-1] Table 4 took 35.1576 sec, wrote 3465867289 right entries [P3-2] Table 4 took 31.8105 sec, wrote 3465867289 left entries, 3465867289 final [P3-1] Table 5 took 35.7409 sec, wrote 3532538204 right entries [P3-2] Table 5 took 32.6338 sec, wrote 3532538204 left entries, 3532538204 final [P3-1] Table 6 took 37.332 sec, wrote 3712904952 right entries [P3-2] Table 6 took 33.6299 sec, wrote 3712904952 left entries, 3712904952 final [P3-1] Table 7 took 37.7237 sec, wrote 4293578337 right entries [P3-2] Table 7 took 37.6059 sec, wrote 4293578337 left entries, 4293578337 final Phase 3 took 415.852 sec, wrote 21873984212 entries to final plot [P4] Starting to write C1 and C3 tables [P4] Finished writing C1 and C3 tables [P4] Writing C2 table [P4] Finished writing C2 table Phase 4 took 62.2083 sec, final plot size is 108816493955 bytes Total plot creation time was 1353.21 sec (22.5535 min)

ataa commented 3 years ago

To make it automaticly for example on crontab it would be like this?

Try /sbin/fstrim but as far as I remember, 18.04 comes with fstrim service (default: weekly). So there's no need to add a cron for it. Google fstrim.service or fstrim.timer

jmgoycoolea commented 3 years ago

To make it automaticly for example on crontab it would be like this?

Try /sbin/fstrim but as far as I remember, 18.04 comes with fstrim service (default: weekly). So there's no need to add a cron for it. Google fstrim.service or fstrim.timer

I migrated to 20.04 in the beginning of your recommendation. Thank you so much, is working at last!! Including /sbin.