https://github.com/ivan-pi/cumsum_benchmark
Some benchmarks for the cumulative sum of an array
https://github.com/ivan-pi/cumsum_benchmark
Last synced: 4 months ago
JSON representation
Some benchmarks for the cumulative sum of an array
- Host: GitHub
- URL: https://github.com/ivan-pi/cumsum_benchmark
- Owner: ivan-pi
- Created: 2021-10-03T01:25:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-04T10:04:08.000Z (over 4 years ago)
- Last Synced: 2025-09-08T07:46:27.418Z (4 months ago)
- Language: Fortran
- Size: 113 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cumsum_benchmark
Some benchmarks for the cumulative sum of an array.
For a lengthier discussion see the thread at Discourse: https://fortran-lang.discourse.group/t/what-is-the-fastest-way-to-do-cumulative-sum-in-fortran-to-mimic-matlab-cumsum/1976
## C++
### GNU C++ compiler
```
g++ -Wall -O3 cumsum_benchmark.cpp -o cpp_cumsum
./cpp_cumsum > output_cpp.txt
```
### Intel C++ compiler
In contrast to Fortran, the Intel C++ compiler uses the same flags as the GNU compiler.
```
icpc -Wall -O3 cumsum_benchmark.cpp -o cpp_sumsum
./cpp_cumsum > output_cpp.txt
```
## Python
```
python cumsum_benchmark.py > output_python.txt
```
## Fortran
### Intel Fortran compiler (Classic)
```
ifort -warn all -O3 cumsum_benchmark.f90 -o f_cumsum
```
### GNU Fortran Compiler
```
gfortran -Wall -O3 cumsum_benchmark.f90 -o f_cumsum
```
Gfortran crashes on `cumsum_step3` for some unknown reason.