plutus-rustus icon indicating copy to clipboard operation
plutus-rustus copied to clipboard

Fully utilizing the cpu

Open ethicalliving opened this issue 1 year ago • 5 comments

Hi,

Thank you for the project. I have 8 cores and with hyperthreading 16 logical processors. For plutus python when I was checking with Htop utility all 16 processes were showing 100% all the time.

I tested with your Rust code. With this project only 8 cores are utilized 100%. Rust can't see the logical processors like Python does. How can we solve this so that all CPU power is used all the time?

ethicalliving avatar Aug 31 '22 21:08 ethicalliving

HI @ethicalliving, thanks for feedback. It's quite possible, i made a small adjustment #3f0cb33 , for now program computes on all logical cores, meaning if you have 8 core Intel process that supports hyperthreading you will be able to run it on all 16 logical cores. Please check and let me know if it works for you. regards

a137x avatar Sep 01 '22 11:09 a137x

also added simple bash script to run program in the background for linux users.

a137x avatar Sep 01 '22 12:09 a137x

Hi @a137x

New code indeed fully utilizes all cores. All my 16 cores are 100% utilized. However I noticed performance impact. Do you happen to know why this could be the case?

With old code utilizing 8 cores the program checked 740 000 addresses in 50.5 sec with iterations around 14600 With new code the program checked 430 000 addresses in 50.5 sec with iterations around 8500 even though working with 16 cpus

ethicalliving avatar Sep 01 '22 13:09 ethicalliving

Well I made a brief research about this issue. I guess this is because Hyperthreaing is not really working the way you expected. Take a looks this link

While hyperthreading does not double the performance of a system, it can increase performance by better utilizing idle resources leading to greater throughput for certain important workload types. An application running on one logical processor of a busy core can expect slightly more than half of the throughput that it obtains while running alone on a non-hyperthreaded processor.

a137x avatar Sep 01 '22 15:09 a137x

Thank you for clarifying. I didn't know that. So for this project CPU's hyperthreading is not important. I have reverted back and using your older version of code at the moment.

ethicalliving avatar Sep 01 '22 15:09 ethicalliving