Skip to content
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

Add script to run clang-tidy on all builds #337

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/cholla-nv-compute-sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if [ -z "$tool" ]; then
fi

# Get Paths
cholla_root=$(git rev-parse --show-toplevel)
cholla_root="$(dirname "$(dirname "$(readlink -fm "$0")")")"
cholla_exe=$(find "${cholla_root}" -name cholla.*)
cholla_parameter_file="${cholla_root}/examples/3D/sod.txt"
COMPUTE_SANITIZER=$(which compute-sanitizer)
Expand Down
3 changes: 2 additions & 1 deletion tools/clang-format_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# - GNU Find, the default macos version won't work

# Get the location of Cholla
cholla_root=$(git rev-parse --show-toplevel)
cholla_root="$(dirname "$(dirname "$(readlink -fm "$0")")")"
cd $cholla_root

# Get a list of all the files to format
readarray -t files <<<$(find ${cholla_root} -regex '.*\.\(h\|hpp\|c\|cpp\|cu\|cuh\)$' -print)
Expand Down
23 changes: 23 additions & 0 deletions tools/clang-tidy_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Description:
# Run clang-tidy on all build types in parallel. Note that this spawns 2x the
# number of build types threads since each type has a thread for the CPU code
# and a thread for the GPU code

# If ctrl-c is sent trap it and kill all clang-tidy processes
trap "kill -- -$$" EXIT

# cd into the Cholla directory. Default to ${HOME}/Code/cholla
cholla_root="$(dirname "$(dirname "$(readlink -fm "$0")")")"
cd $cholla_root

# Run all clang-tidy build types in parallel
builds=( hydro gravity disk particles cosmology mhd dust)
for build in "${builds[@]}"
do
make tidy TYPE=$build &
done

# Wait for clang-tidy to finish
wait