Skip to content

Commit

Permalink
Updated readme for release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pauleaster authored Nov 18, 2021
1 parent 1702d15 commit c85ce85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

This is a rust port of the RNS code. If you want information on this rust port then you can contact me at [Paul Easter](mailto:paul.john.easter@gmail.com). The code structure, at this point in time, deliberately follows the original structure for the C code. The only difference is that XXX.c is now XXX.rs. However, some functions may have been moved.

So far this code achieves the same numerical result as the C code to around a fractional error of 1e-11, which I found really interesting. Though, as much as possible, I performed a literal translation from C to rust avoiding the temptation to optimise before confirming that the results were comparable. I did perform a couple of optimisations though. I profiled the rust code with flamegraph.rs and found that a significant amount of time was spent in the spin() function, specifically, f64::sin(). I found that a sin() loop was being executed for each run of spin() which generated fixed values each time. So I moved this out to the main() function and passed this data to spin() directly. Even without this optimisation, I found that the rust code was faster than the C code for the same data (when using the `cargo run --release` flag). After this optimisation, the rust code executed in 1.2 seconds and the c code in 2.4 seconds.
So far this code achieves the same numerical result as the C code to around a fractional error of 1e-11, which I found really interesting. Though, as much as possible, I performed a literal translation from C to rust avoiding the temptation to optimise before confirming that the results were comparable. I did perform a couple of optimisations though. I profiled the rust code with flamegraph.rs and found that a significant amount of time was spent in the spin() function, specifically, f64::sin(). I found that a sin() loop was being executed for each run of spin() which generated fixed values each time. So I moved this out to the main() function and passed this data to spin() directly. Even without this optimisation, I found that the rust code was faster than the C code for the same data (when using the `cargo run --release` flag). After this optimisation, the rust code executed in 1.2 seconds and the c code in 2.4 seconds. I have added in movies that show the running of both codes with the same data. The rust code also generates html files showing contour plots of various system parameters they can be found in the ./html folder.

# Details of original C code

The original C code along with the equation of state files were downloaded from http://www.gravity.phys.uwm.edu/rns/. The LS220 equation of state file was downloaded from https://core-gitlfs.tpi.uni-jena.de/eos/ls220. These equation of state files were used for testing.

Expand Down

0 comments on commit c85ce85

Please sign in to comment.