Cryptonomic / MonadicDNA

Secure personal genomics using cryptography
9 stars 2 forks source link

Implemented multi-core support for faster execution #66

Closed amardeepio closed 3 months ago

amardeepio commented 3 months ago

Used rayon crate to perform parallel execution across all threads.

On single thread :

2024-07-15 23:49:24 [INFO] - Hello, Zama!
2024-07-15 23:49:24 [INFO] - Setting up Zama env
2024-07-15 23:49:24 [INFO] - Number of lines to process: 1000000
2024-07-15 23:49:25 [INFO] - Lines of processed data: 553190
2024-07-15 23:51:39 [INFO] - Lines of encrypted data: 553190
2024-07-15 23:51:39 [INFO] - Lookup result: true
2024-07-15 23:51:39 [INFO] - Lookup result: false
2024-07-15 23:53:53 [INFO] - Genotype frequencies: {9: 9021, 10: 81789, 7: 39357, 4: 341, 2: 9106, 5: 139432, 3: 39307, 0: 12358, 1: 81948, 6: 711, 8: 139820}
2024-07-15 23:53:53 [INFO] - run_iteration took: 269.620158125s
2024-07-15 23:53:53 [INFO] - Bye, Zama!

Multi thread execution using Rayon crate:

cargo run --release
   Compiling zama-poc v0.1.0 (/home/amardeep/MonadicDNA/zama-poc)
    Finished release [optimized] target(s) in 0.82s
     Running `target/release/zama-poc`
2024-07-22 15:40:15 [INFO] - Hello, Zama!
2024-07-22 15:40:15 [INFO] - Setting up Zama env
2024-07-22 15:40:16 [INFO] - Number of lines to process: 1000000
2024-07-22 15:40:16 [INFO] - Lines of processed data: 553190
2024-07-22 15:40:29 [INFO] - Lines of encrypted data: 553190
2024-07-22 15:40:29 [INFO] - Lookup result: true
2024-07-22 15:40:29 [INFO] - Lookup result: false
2024-07-22 15:40:42 [INFO] - Genotype frequencies: {10: 81789, 0: 12358, 2: 9106, 5: 139432, 4: 341, 9: 9021, 7: 39357, 6: 711, 1: 81948, 8: 139820, 3: 39307}
2024-07-22 15:40:42 [INFO] - run_iteration took: 26.91329741s
2024-07-22 15:40:42 [INFO] - Bye, Zama!

10 times improvement in execution.

amardeepio commented 3 months ago

Why did you remove all my changes?

I removed those in mine as the my code has changes from your older commit . The changes I made were according to the previous commit you made.