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

Ci/sanitize #1521

Merged
merged 56 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6fb9896
Add santizer
thorstenhater Apr 23, 2021
346fbe9
Try PR for setting up a PR.
thorstenhater Apr 23, 2021
f4b75c6
Re-name.
thorstenhater Apr 23, 2021
8e334ea
Re-name.
thorstenhater Apr 23, 2021
14845e4
Rename part II
thorstenhater Apr 23, 2021
e6dea12
Fix typo.
thorstenhater Apr 23, 2021
1af797d
Fix leak and address issues.
thorstenhater Apr 23, 2021
903fc74
Clean-up config.
thorstenhater Apr 23, 2021
abdd2b2
Let all runs complete before failing.
thorstenhater Apr 23, 2021
2d3a9ad
Fix yaml.
thorstenhater Apr 23, 2021
5baa95d
Fix pedantic, if true, complaint.
thorstenhater Apr 23, 2021
e46c023
Test?.
thorstenhater Apr 23, 2021
6c30c43
Revert "Test?."
thorstenhater Apr 23, 2021
81fd493
Use both SIMD and scalar; prettify name.
thorstenhater Apr 23, 2021
fb59bda
Fix compiler warnings.
thorstenhater Apr 28, 2021
005bed6
Merge.
thorstenhater May 4, 2021
f8d85eb
Adress review.
thorstenhater May 4, 2021
792bc4d
Merge master.
thorstenhater May 5, 2021
b3727b7
Try fix.
thorstenhater May 10, 2021
d749dce
Merge branch 'master' into ci/sanitize
thorstenhater May 10, 2021
55c8959
Make GH Actions happy/ier.
thorstenhater May 10, 2021
62f8992
Merge.
thorstenhater May 10, 2021
8ef9252
Merge.
thorstenhater May 10, 2021
687c315
Address use-after-free report.
thorstenhater May 12, 2021
794e08e
Args cannot be both in `local` and `call`.
thorstenhater May 12, 2021
3f1f6f1
Make dryrun example more robust for MPI.
thorstenhater May 12, 2021
4b81ca1
shuffle names, as per review.
thorstenhater May 12, 2021
cf55dd5
Shuffle some more, skip DeathTest when sanitizing.
thorstenhater May 12, 2021
c93d900
Leak is a subset of Address, so get rid of leak.
thorstenhater May 12, 2021
9b1cda9
Drop MPI, OpenMPI leaks. Typo fix.
thorstenhater May 12, 2021
6c3b6e7
Typo.
thorstenhater May 12, 2021
8653801
Strip down yml. Use libc++.
thorstenhater May 12, 2021
b3f17e3
disable instrumentation w/ thread san.
thorstenhater May 12, 2021
50c9cd3
Poke at weird bug.
thorstenhater May 12, 2021
a48c048
Poke 2.
thorstenhater May 12, 2021
ea3ffe8
Add ignorelist.
thorstenhater May 12, 2021
36f1723
Part 2.
thorstenhater May 12, 2021
b1e0863
Fix flags.
thorstenhater May 12, 2021
29ef492
Make file explicit.
thorstenhater May 12, 2021
23440b6
Fix path.
thorstenhater May 18, 2021
4a4d00f
Add modcc.
thorstenhater May 18, 2021
d7e84b6
Experiment.
thorstenhater May 18, 2021
8844225
Experiment 2.
thorstenhater May 18, 2021
a00b34e
Remove memory sanitizer.
thorstenhater May 18, 2021
c0214d8
Re-instantiate python as per review question.
thorstenhater May 20, 2021
1feb78a
Merge branch 'master' into ci/sanitize
thorstenhater May 20, 2021
443e8b7
LD_PRELOAD Yaaay.
thorstenhater May 20, 2021
c52f0d8
Merge branch 'master' of https://github.com/arbor-sim/arbor into ci/s…
thorstenhater May 20, 2021
5884a52
Merge branch 'ci/sanitize' of github.com:thorstenhater/arbor into ci/…
thorstenhater May 20, 2021
a70c93f
Quotes.
thorstenhater May 20, 2021
211ccfb
Give modcc the benefit of LD_PRELOAD.
thorstenhater May 20, 2021
77155f3
Please?
thorstenhater May 20, 2021
2aeb710
Roll back python in CI sanitize.
thorstenhater May 25, 2021
e8c6fd4
Formatting.
thorstenhater May 25, 2021
31bf8df
Merge remote-tracking branch 'origin/master' into ci/sanitize
thorstenhater Jun 28, 2021
af1a849
Remove leftovers.
thorstenhater Jul 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 23 additions & 100 deletions .github/workflows/sanitize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,124 +7,47 @@ on:
jobs:
build:
name: "Sanitize"
runs-on: ${{ matrix.os }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
name: ["Linux Clang -fsanitize ${{ matrix.sanitizer }}"]
os: ["ubuntu-20.04"]
cc: ["clang-10"]
cxx: ["clang++-10"]
py: ["3.9"]
cmake: ["3.19.x"]
mpi: ["ON"]
name: ["Sanitize"]
sanitizer: ["address", "undefined", "thread"]
simd: ["ON", "OFF"]
sanitizer: ["address", "leak", "undefined", "memory", "thread"]
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
# We set PYTHONPATH instead of installing arbor to avoid distribution/OS specific behaviour.
PYTHONPATH: ${{ github.workspace }}/build/python
CC: clang-10
CXX: clang++-10
ASAN_OPTIONS: detect_leaks=1
steps:
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.7
with:
cmake-version: ${{ matrix.cmake }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: OpenMPI cache
uses: actions/cache@v2
id: cache-ompi
with:
path: ~/openmpi-4.0.2
key: ${{ matrix.os }}-openmpi-4.0.2-${{ matrix.cxx }}
- name: Build OpenMPI
if: ${{ steps.cache-ompi.outputs.cache-hit != 'true' }}
run: |
echo cache-hit='${{ steps.cache-ompi.outputs.cache-hit }}'
cd ~
wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.2.tar.gz
tar -xvf ./openmpi-4.0.2.tar.gz
cd openmpi-4.0.2
./configure --disable-mpi-fortran
make -j4
- name: Install OpenMPI
run: |
echo "Going to install ompi"
cd ~
cd openmpi-4.0.2
sudo make install
cd -
- name: Update shared library cache
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: sudo ldconfig
- name: Install Python packages
run: pip install numpy sphinx svgwrite sphinx-rtd-theme mpi4py pandas seaborn
cmake-version: 3.19.x
- name: Clone w/ submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Check config
run: |
$CC --version
$CXX --version
python --version
mpic++ --show
mpicc --show
echo $PYTHONPATH
- name: Build arbor
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer" -DCMAKE_C_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=${{ matrix.sanitizer }}" -DCMAKE_MODULE/_LINKER_FLAGS="-fsanitize=${{ matrix.sanitizer }}" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.mpi }} -DARB_USE_BUNDLED_LIBS=ON
make -j4 tests examples pyarb html
export LD_PRELOAD=$(clang -print-file-name=libclang_rt.san-x86_64.so)
export SAN="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer"
cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="$SAN" -DCMAKE_C_FLAGS="$SAN" -DCMAKE_EXE_LINKER_FLAGS="$SAN" -DCMAKE_MODULE_LINKER_FLAGS="$SAN" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_VECTORIZE=${{ matrix.simd }} -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
make -j4 VERBOSE=1 tests examples pyarb
cd -
- name: Run unit tests
run: |
build/bin/unit
build/bin/unit --gtest_filter=-*DeathTest
build/bin/unit-modcc
- if: ${{ matrix.mpi == 'ON' }}
name: Run MPI tests
run: mpirun -n 4 -oversubscribe build/bin/unit-mpi
- if: ${{ matrix.mpi == 'OFF' }}
name: Run examples
run: |
build/bin/bench
build/bin/brunel
build/bin/dryrun
build/bin/gap_junctions
build/bin/generators
build/bin/lfp
build/bin/probe-demo v
build/bin/ring
build/bin/single-cell
- if: ${{ matrix.mpi == 'ON' }}
name: Run examples with MPI
run: |
mpirun -n 4 -oversubscribe build/bin/bench
mpirun -n 4 -oversubscribe build/bin/brunel
mpirun -n 4 -oversubscribe build/bin/dryrun
mpirun -n 4 -oversubscribe build/bin/gap_junctions
mpirun -n 4 -oversubscribe build/bin/generators
mpirun -n 4 -oversubscribe build/bin/lfp
mpirun -n 4 -oversubscribe build/bin/probe-demo v
mpirun -n 4 -oversubscribe build/bin/ring
mpirun -n 4 -oversubscribe build/bin/single-cell
- name: Run python tests
run: python python/test/unit/runner.py -v2
- if: ${{ matrix.mpi == 'ON' }}
name: Run python+MPI tests
run: mpirun -n 4 -oversubscribe python python/test/unit_distributed/runner.py -v2
- name: Run Python examples
run: |
python python/example/network_ring.py
python python/example/single_cell_model.py
python python/example/single_cell_recipe.py
python python/example/single_cell_stdp.py
python python/example/brunel.py -n 400 -m 100 -e 20 -p 0.1 -w 1.2 -d 1 -g 0.5 -l 5 -t 100 -s 1 -G 50 -S 123
python python/example/single_cell_swc.py python/example/single_cell_detailed.swc
python python/example/single_cell_detailed.py python/example/single_cell_detailed.swc
python python/example/single_cell_detailed_recipe.py python/example/single_cell_detailed.swc
python python/example/single_cell_cable.py
- name: Run examples
run: |
build/bin/bench
build/bin/brunel
build/bin/dryrun
build/bin/gap_junctions
build/bin/generators
build/bin/lfp
build/bin/probe-demo v
build/bin/ring
build/bin/single-cell
18 changes: 9 additions & 9 deletions example/dryrun/dryrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct run_params {
double min_delay = 10;
double duration = 100;
cell_parameters cell;
bool defaulted = true;
};

void write_trace_json(const arb::trace_data<double>& trace);
Expand Down Expand Up @@ -142,15 +143,10 @@ int main(int argc, char** argv) {
#ifdef ARB_MPI_ENABLED
else {
ctx = arb::make_context(resources, MPI_COMM_WORLD);
{
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
root = rank==0;
}
if (params.defaulted) params.num_ranks = arb::num_ranks(ctx);
root = arb::rank(ctx)==0;
}
#endif
assert(arb::num_ranks(ctx)==params.num_ranks);


#ifdef ARB_PROFILE_ENABLED
arb::profile::profiler_initialize(ctx);
Expand All @@ -161,10 +157,11 @@ int main(int argc, char** argv) {
std::cout << "gpu: " << (has_gpu(ctx)? "yes": "no") << "\n";
std::cout << "threads: " << num_threads(ctx) << "\n";
std::cout << "mpi: " << (has_mpi(ctx)? "yes": "no") << "\n";
std::cout << "ranks: " << num_ranks(ctx) << "\n" << std::endl;

std::cout << "ranks: " << num_ranks(ctx) << "(" << params.num_ranks << ")\n" << std::endl;
std::cout << "run mode: " << distribution_type(ctx) << "\n";

assert(arb::num_ranks(ctx)==params.num_ranks);

arb::profile::meter_manager meters;
meters.start(ctx);

Expand Down Expand Up @@ -269,6 +266,9 @@ run_params read_options(int argc, char** argv) {
std::cout << "Using default parameters.\n";
return params;
}
else {
params.defaulted = false;
}
if (argc>2) {
throw std::runtime_error("More than one command line option is not permitted.");
}
Expand Down
3 changes: 3 additions & 0 deletions test/unit/instrument_malloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#if __has_feature(address_sanitizer)
#undef CAN_INSTRUMENT_MALLOC
#endif
# if __has_feature(thread_sanitizer)
#undef CAN_INSTRUMENT_MALLOC
# endif
#endif
// This is how gcc tells us.
#if defined(__SANITIZE_ADDRESS__)
Expand Down