This is a part of the course "Advanced Computing for Engineering and Science Software at Scale".
Important
To view the speedup and other timing analysis, please check the SpeedupAnalysis directory. It contains two self describing IPython Notebooks (plotCAS2.ipynb and total_time.ipynb).
- Install
Kokkoswith eitherOpenMPorCUDAbackend. Here's an example cmake command:
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_INSTALL_PREFIX=build/install \
-DKokkos_ENABLE_OPENMP=ON
cmake --build build -j2 --target installTip
Don't forget to load necessary modules for compilers. On SCOREC Machines, you can use the following command:
module use /opt/scorec/spack/rhel9/v0201_4/lmod/linux-rhel9-x86_64/Core/
module load gcc/12.3.0-iil3lno mpich/4.1.1-xpoyz4t cuda/12.1.1-zxa4msk
module load cmakeTip
If you are running on CCI, please use module load gcc spectrum-mpi cuda cmake and g++ compiler. It is not tested for other compilers. If you want to profile, install kokkos with -DKokkos_ENABLE_LIBDL=ON flag.
- Installing
Catch2is optional. If you enable testing but don't provideCatch2_ROOT, it will fetch it automatically. - To install the project, use
cmakeas usual. UseAssignment_ENABLE_TESTING(default ON) to enable testing. An example configuration for SCOREC Machines is given inscorec-config.shfile. - To run tests, use
ctestormake testafter building the project. Note that some tests may not work if the test binaries are run directly from the build directory. Usetests/directory in that case.
Caution
Please fork this repository and add all changes through pull requests (not directly pushing to the main branch).
We are using clang-format to enforce a consistent coding style.
Here we are using the Google style. To format code, run:
clang-format -i <file_name>Tip
If you do not have clang-format installed, you can use my installation /lore/hasanm4/sourcestoInstall/clangd/llvm-project/build/bin/clang-format. It should be accessible from any SCOREC machine.
To add this directory to your PATH variable in your ~/.bashrc, run:
echo 'export PATH=$PATH:/lore/hasanm4/sourcestoInstall/clangd/llvm-project/build/bin' >> ~/.bashrc
source ~/.bashrcImportant
It will greatly reduce the manual labor of formatting code.
- Do
vim .git/hooks/pre-commitand add the following lines:
#!/bin/bash
extensions="cpp hpp h"
files=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(${extensions// /|})$")
[ -z "$files" ] && exit 0
for file in $files; do
if [ -f "$file" ]; then
echo "Formatting $file"
clang-format -i "$file"
git add "$file"
fi
done
exit 0- Make the hook executable:
chmod +x .git/hooks/pre-commit- Now, every time you commit,
clang-formatwill automatically format the changed.h, .cpp, .hppfiles.