-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile nbody
test from LFortran
#89
Conversation
DEV: Added support for sqrt intrinsic DEV: Compile time evaluation of BinOp node for Real and Integer DEV: Added support for StructTypeConstructor DEV: Added support for initialisation of const variables
Not ready for review yet. |
DEV: Added support for compile time evaluation for unary minus DEV: Added minor fixes for const types
…_array_section_data_only
If you compile using: $ clang++ -O3 -march=native -ffast-math nbody.cpp Then I get 2.827s on Apple M1 Max and Clang 16.0.6. I get the following timings without optimization: $ lc nbody.cpp
$ time ./nbody.out
...
./nbody.out 1.30s user 0.00s system 99% cpu 1.305 total And with optimizations: $ CPATH=$CONDA_PREFIX/include lc --show-llvm integration_tests/nbody.cpp > x.ll
$ clang++ -O3 -march=native -ffast-math x.ll src/runtime/liblc_runtime_static.a
$ time ./a.out
[...]
./a.out 0.17s user 0.00s system 98% cpu 0.170 total As far as compilation speed goes, I get 1.019s for LC and 1.428s for Clang++, in the default (no compiler options) mode. |
I also tried the fastest C++ version from here: https://gist.github.com/certik/c7803fe6cbf4f8a5ec3070dd699ecad3 And I get $ clang++ -O3 -march=native -ffast-math a.cpp
$ time ./a.out 1000000
-0.169075164
-0.169086185
./a.out 1000000 0.04s user 0.00s system 92% cpu 0.046 total So 3.6x faster than our LC version. Overall not bad I think as a start. We'll optimize things more in the future. This version https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-gpp-3.html runs at 0.073s, so only 2.3x faster. |
Sure. I will work on these two examples next. There are excellent features which will be added through these two examples. |
num = 1000000