pandeyshubham25 / pagerank

0 stars 0 forks source link

Adding trivial parallel and serial implementations #8

Closed pandeyshubham25 closed 2 years ago

pandeyshubham25 commented 2 years ago

Generated scores look good to me. Tried on the sample graph in test directory. Things to note - 1) We are not using threshold but number of iterations as stopping criteria 2) The two implementations (serial and trivial parallel) only output 3 things a) Parameter values b) Load time c) Iterations time to the console. 3) I decided to write both the page ids and their final scores. We can later parse whatever information we like during analysis as its always better to have extra information.

How to run - g++ -fopenmp prank_serial.cpp -o prank_serial ./prank_serial 4 100 0.35 ../test/testdata

Lets not merge this branch at the moment, i strongly feel theres much to do in terms of code beautification :|

NMerz commented 2 years ago

Aside from the mostly duplicate files, I don't know that it is worth any beautification for a project this short. If you want a quick and dirty way to combine in one file, you can add a couple an extra define mode(s) to the make file (or I can if you want) like: https://github.com/pandeyshubham25/pagerank/pull/6/files#diff-05890e6fc7ed8c96d26d42a367bed1b0cc6377f13fd450b9fb448383e47069a0R19-R23 and https://github.com/pandeyshubham25/pagerank/pull/6/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R14-R30

pandeyshubham25 commented 2 years ago

Agreed. Lets just focus on the main file then, as we are anyway using the other two just for generating results for comparison.

NMerz commented 2 years ago

I need more (slightly more) complicated build configs for Mac do you mind if cherry-pick over the Makefile commits from #6 ? Or I can just keep them local if that would clutter this PR.

pandeyshubham25 commented 2 years ago

Please go ahead and pick whatever helps you to run code, i dont mind!

NMerz commented 2 years ago

I believe clock time is currently cpu time used. Is this intentional or do we want wall time? Maybe both for efficiency calc? https://www.cplusplus.com/reference/ctime/clock/

A couple times below:

(base) nmerz@Nathans-MacBook-Pro pagerank % time  ./prank_serial 9, 30, 0.850000, road_usa
Serial parameters: road_usa 30 0.85
Load time: 5.14273
Iteration time: 102.062
./prank_serial 9, 30, 0.850000, road_usa  109.09s user 0.33s system 99% cpu 1:49.54 total
(base) nmerz@Nathans-MacBook-Pro pagerank % time  ./prank_trivial_parallel 9, 30, 0.850000, road_usa 
Parallel parameters: road_usa 30 0.85
Load time: 5.18695
Iteration time: 126.189
./prank_trivial_parallel 9, 30, 0.850000, road_usa  130.91s user 2.94s system 580% cpu 23.041 total
pandeyshubham25 commented 2 years ago

I see, lets do wall. lemme patch this with the floating point precision stuff.. got a little late. sorryy!

pandeyshubham25 commented 2 years ago

Added my changes 1) Floating point precision set to 10 2) Clock time now using chrono library

Additionally, can you add gitignore to gitignore ? I have a different set of files in my local that i set to ignore and pulling your changes "disrupts" my gitignore :P

NMerz commented 2 years ago

Additionally, can you add gitignore to gitignore ? I have a different set of files in my local that i set to ignore and pulling your changes "disrupts" my gitignore :P

Just add yours to the gitignore, more in there isn't harmful. I think it should be a tracked file though for executables, builds, etc.

pandeyshubham25 commented 2 years ago

oh i see lol, i ll add mine next time too, i have some garbage coming from ide that i have put into it