Update grid.cc #5034
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Compile and lint | |
on: | |
push: | |
branches-ignore: | |
- classic* | |
workflow_dispatch: | |
# pull_request: | |
# branches-ignore: | |
# - classic* | |
jobs: | |
cppcheck: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install dependencies | |
run: | | |
brew update | |
brew install gsl openmpi cppcheck || true | |
cp artisoptions_nltenebular.h artisoptions.h | |
make version.h | |
- name: run cppcheck | |
run: | | |
cppcheck --version | |
cppcheck --force --error-exitcode=1 --language=c++ --std=c++20 --enable=all --inconclusive --suppress=knownConditionTrueFalse --suppress=constParameterCallback --suppress=redundantAssignment --suppress=knownArgument --suppress=missingIncludeSystem --suppress=unusedFunction --check-level=exhaustive . | |
clang-format: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check | |
uses: jidicula/clang-format-action@v4.13.0 | |
with: | |
clang-format-version: '18' | |
check-path: . | |
clang-tidy: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: install dependencies | |
run: | | |
brew update | |
brew install openmpi gsl || true | |
- name: install llvm | |
run: | | |
brew install llvm || true | |
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV | |
echo "CPPFLAGS=-I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV | |
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV | |
echo "LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV | |
echo "CPATH=/opt/homebrew/opt/include" >> $GITHUB_ENV | |
echo "compiledb" > requirements.txt | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
python-version: '3.12' | |
- name: Generate compile_commands.json | |
run: | | |
python3 -m pip install compiledb | |
cp artisoptions_nltenebular.h artisoptions.h | |
make version.h | |
python3 -m compiledb -n --full-path make | |
- name: cat compile_commands.json | |
run: cat compile_commands.json | |
- name: run-clang-tidy | |
run: | | |
clang-tidy --version | |
run-clang-tidy | |
compile: | |
env: | |
CXX: g++ | |
strategy: | |
matrix: | |
compiler: | |
[ | |
{name: gcc, ver: 11}, | |
{name: gcc, ver: 12}, | |
{name: gcc, ver: 13}, | |
{name: gcc, ver: 14}, | |
{name: nvc++, ver: '24.7'}, | |
] | |
mpi: [ON, OFF] | |
fail-fast: false | |
runs-on: ubuntu-24.04 | |
name: ${{ matrix.compiler.name }} ${{ matrix.compiler.ver }}${{ matrix.mpi == 'ON' && ' MPI' || ''}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: CPU type and core count | |
id: cpu-count | |
run: | | |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3 | |
#python3 -m pip install psutil | |
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")' | |
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")' | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
- name: Install gcc | |
if: matrix.compiler.name == 'gcc' | |
uses: fortran-lang/setup-fortran@v1 | |
with: | |
compiler: gcc | |
version: ${{ matrix.compiler.ver }} | |
- name: Install nvc++ | |
if: matrix.compiler.name == 'nvc++' | |
uses: fortran-lang/setup-fortran@v1 | |
with: | |
compiler: nvidia-hpc | |
version: ${{ matrix.compiler.ver }} | |
# - name: Install CUDA Toolkit | |
# uses: Jimver/cuda-toolkit@master | |
# if: matrix.compiler.name == 'nvc++' | |
# with: | |
# log-file-suffix: '${{matrix.compiler.ver}}.txt' | |
# method: 'network' | |
# sub-packages: '"nvcc", "cudart"' | |
- name: Set nvc++ as compiler | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
echo "CXX=nvc++" >> $GITHUB_ENV | |
echo "OMPI_CXX=nvc++" >> $GITHUB_ENV | |
- name: install gsl | |
run: | | |
sudo apt install libgsl-dev | |
- name: install tbb | |
if: matrix.compiler.name == 'gcc' | |
run: | | |
sudo apt install libtbb-dev | |
- name: install openmpi | |
if: matrix.mpi == 'ON' | |
run: | | |
sudo apt install -y openmpi-bin libopenmpi-dev | |
- name: install OpenMP | |
run: | | |
sudo apt-get install -y libomp5 libomp-dev | |
- name: Compile classic mode | |
run: | | |
$CXX -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode OPENMP=ON | |
run: | | |
make clean | |
make MPI=${{matrix.mpi}} OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode STDPAR=ON | |
run: | | |
$CXX -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode STDPAR=ON GPU=ON | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
$CXX -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode OPENMP=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode STDPAR=ON | |
if: matrix.compiler.name != 'nvc++' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode STDPAR=ON GPU=ON | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
mac-llvm: | |
runs-on: macos-14 | |
env: | |
CXX: clang++ | |
strategy: | |
matrix: | |
mpi: [ON, OFF] | |
openmp: [ON, OFF] | |
fail-fast: false | |
name: macOS llvm clang ${{ matrix.mpi == 'ON' && ' MPI' || ''}}${{ matrix.openmp == 'ON' && ' OpenMP' || ''}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: CPU core count | |
id: cpu-count | |
run: | | |
#python3 -m pip install psutil | |
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")' | |
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")' | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: install dependencies | |
run: | | |
brew update | |
brew install gsl || true | |
- name: install llvm | |
run: | | |
brew install llvm || true | |
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ $LDFLAGS" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
- name: install OpenMP | |
if: matrix.openmp == 'ON' | |
run: | | |
brew install libomp || true | |
brew link --force libomp | |
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib $LDFLAGS" >> $GITHUB_ENV | |
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include $CXXFLAGS" >> $GITHUB_ENV | |
- name: install OpenMPI | |
if: matrix.mpi == 'ON' | |
run: | | |
brew install openmpi || true | |
- name: install onedpl and tbb | |
run: | | |
brew install onedpl tbb | |
echo "LIBRARY_PATH=$HOMEBREW_PREFIX/lib:$LIBRARY_PATH" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=$HOMEBREW_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "CPATH=$HOMEBREW_PREFIX/include:$CPATH" >> $GITHUB_ENV | |
- name: Compile classic mode | |
run: | | |
$CXX -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode STDPAR=ON | |
if: matrix.openmp != 'ON' | |
run: | | |
$CXX -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode STDPAR=ON | |
if: matrix.openmp != 'ON' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make MPI=${{matrix.mpi}} STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec |