Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arbor-sim
arbor
Commits
7ddefe61
Unverified
Commit
7ddefe61
authored
3 years ago
by
thorstenhater
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ci/sanitize (#1521)
Add clang sanitizer passes to GH CI.
parent
cb36a7cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.github/workflows/sanitize.yml
+22
-100
22 additions, 100 deletions
.github/workflows/sanitize.yml
example/dryrun/dryrun.cpp
+9
-9
9 additions, 9 deletions
example/dryrun/dryrun.cpp
test/unit/instrument_malloc.hpp
+3
-0
3 additions, 0 deletions
test/unit/instrument_malloc.hpp
with
34 additions
and
109 deletions
.github/workflows/sanitize.yml
+
22
−
100
View file @
7ddefe61
...
@@ -7,124 +7,46 @@ on:
...
@@ -7,124 +7,46 @@ on:
jobs
:
jobs
:
build
:
build
:
name
:
"
Sanitize"
name
:
"
Sanitize"
runs-on
:
${{ matrix.os }}
runs-on
:
ubuntu-20.04
strategy
:
strategy
:
fail-fast
:
false
fail-fast
:
false
matrix
:
matrix
:
name
:
[
"
Linux
Clang
-fsanitize
${{
matrix.sanitizer
}}"
]
name
:
[
"
Sanitize"
]
os
:
[
"
ubuntu-20.04"
]
sanitizer
:
[
"
address"
,
"
undefined"
,
"
thread"
]
cc
:
[
"
clang-10"
]
cxx
:
[
"
clang++-10"
]
py
:
[
"
3.9"
]
cmake
:
[
"
3.19.x"
]
mpi
:
[
"
ON"
]
simd
:
[
"
ON"
,
"
OFF"
]
simd
:
[
"
ON"
,
"
OFF"
]
sanitizer
:
[
"
address"
,
"
leak"
,
"
undefined"
,
"
memory"
,
"
thread"
]
env
:
env
:
CC
:
${{ matrix.cc }}
CC
:
clang-10
CXX
:
${{ matrix.cxx }}
CXX
:
clang++-10
# We set PYTHONPATH instead of installing arbor to avoid distribution/OS specific behaviour.
ASAN_OPTIONS
:
detect_leaks=1
PYTHONPATH
:
${{ github.workspace }}/build/python
steps
:
steps
:
-
name
:
Set up cmake
-
name
:
Set up cmake
uses
:
jwlawson/actions-setup-cmake@v1.7
uses
:
jwlawson/actions-setup-cmake@v1.7
with
:
with
:
cmake-version
:
${{ matrix.cmake }}
cmake-version
:
3.19.x
-
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
-
name
:
Clone w/ submodules
-
name
:
Clone w/ submodules
uses
:
actions/checkout@v2
uses
:
actions/checkout@v2
with
:
with
:
submodules
:
recursive
submodules
:
recursive
-
name
:
Check config
run
:
|
$CC --version
$CXX --version
python --version
mpic++ --show
mpicc --show
echo $PYTHONPATH
-
name
:
Build arbor
-
name
:
Build arbor
run
:
|
run
:
|
mkdir build
mkdir build
cd 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
export SAN="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer"
make -j4 tests examples pyarb html
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 -
cd -
-
name
:
Run unit tests
-
name
:
Run unit tests
run
:
|
run
:
|
build/bin/unit
build/bin/unit
--gtest_filter=-*DeathTest
build/bin/unit-modcc
build/bin/unit-modcc
-
if
:
${{ matrix.mpi == 'ON' }}
-
name
:
Run examples
name
:
Run MPI tests
run
:
|
run
:
mpirun -n 4 -oversubscribe build/bin/unit-mpi
build/bin/bench
-
if
:
${{ matrix.mpi == 'OFF' }}
build/bin/brunel
name
:
Run examples
build/bin/dryrun
run
:
|
build/bin/gap_junctions
build/bin/bench
build/bin/generators
build/bin/brunel
build/bin/lfp
build/bin/dryrun
build/bin/probe-demo v
build/bin/gap_junctions
build/bin/ring
build/bin/generators
build/bin/single-cell
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
This diff is collapsed.
Click to expand it.
example/dryrun/dryrun.cpp
+
9
−
9
View file @
7ddefe61
...
@@ -47,6 +47,7 @@ struct run_params {
...
@@ -47,6 +47,7 @@ struct run_params {
double
min_delay
=
10
;
double
min_delay
=
10
;
double
duration
=
100
;
double
duration
=
100
;
cell_parameters
cell
;
cell_parameters
cell
;
bool
defaulted
=
true
;
};
};
void
write_trace_json
(
const
arb
::
trace_data
<
double
>&
trace
);
void
write_trace_json
(
const
arb
::
trace_data
<
double
>&
trace
);
...
@@ -146,15 +147,10 @@ int main(int argc, char** argv) {
...
@@ -146,15 +147,10 @@ int main(int argc, char** argv) {
#ifdef ARB_MPI_ENABLED
#ifdef ARB_MPI_ENABLED
else
{
else
{
ctx
=
arb
::
make_context
(
resources
,
MPI_COMM_WORLD
);
ctx
=
arb
::
make_context
(
resources
,
MPI_COMM_WORLD
);
{
if
(
params
.
defaulted
)
params
.
num_ranks
=
arb
::
num_ranks
(
ctx
);
int
rank
;
root
=
arb
::
rank
(
ctx
)
==
0
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
root
=
rank
==
0
;
}
}
}
#endif
#endif
assert
(
arb
::
num_ranks
(
ctx
)
==
params
.
num_ranks
);
#ifdef ARB_PROFILE_ENABLED
#ifdef ARB_PROFILE_ENABLED
arb
::
profile
::
profiler_initialize
(
ctx
);
arb
::
profile
::
profiler_initialize
(
ctx
);
...
@@ -165,10 +161,11 @@ int main(int argc, char** argv) {
...
@@ -165,10 +161,11 @@ int main(int argc, char** argv) {
std
::
cout
<<
"gpu: "
<<
(
has_gpu
(
ctx
)
?
"yes"
:
"no"
)
<<
"
\n
"
;
std
::
cout
<<
"gpu: "
<<
(
has_gpu
(
ctx
)
?
"yes"
:
"no"
)
<<
"
\n
"
;
std
::
cout
<<
"threads: "
<<
num_threads
(
ctx
)
<<
"
\n
"
;
std
::
cout
<<
"threads: "
<<
num_threads
(
ctx
)
<<
"
\n
"
;
std
::
cout
<<
"mpi: "
<<
(
has_mpi
(
ctx
)
?
"yes"
:
"no"
)
<<
"
\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
"
;
std
::
cout
<<
"run mode: "
<<
distribution_type
(
ctx
)
<<
"
\n
"
;
assert
(
arb
::
num_ranks
(
ctx
)
==
params
.
num_ranks
);
arb
::
profile
::
meter_manager
meters
;
arb
::
profile
::
meter_manager
meters
;
meters
.
start
(
ctx
);
meters
.
start
(
ctx
);
...
@@ -273,6 +270,9 @@ run_params read_options(int argc, char** argv) {
...
@@ -273,6 +270,9 @@ run_params read_options(int argc, char** argv) {
std
::
cout
<<
"Using default parameters.
\n
"
;
std
::
cout
<<
"Using default parameters.
\n
"
;
return
params
;
return
params
;
}
}
else
{
params
.
defaulted
=
false
;
}
if
(
argc
>
2
)
{
if
(
argc
>
2
)
{
throw
std
::
runtime_error
(
"More than one command line option is not permitted."
);
throw
std
::
runtime_error
(
"More than one command line option is not permitted."
);
}
}
...
...
This diff is collapsed.
Click to expand it.
test/unit/instrument_malloc.hpp
+
3
−
0
View file @
7ddefe61
...
@@ -32,6 +32,9 @@
...
@@ -32,6 +32,9 @@
#if __has_feature(address_sanitizer)
#if __has_feature(address_sanitizer)
#undef CAN_INSTRUMENT_MALLOC
#undef CAN_INSTRUMENT_MALLOC
#endif
#endif
# if __has_feature(thread_sanitizer)
#undef CAN_INSTRUMENT_MALLOC
# endif
#endif
#endif
// This is how gcc tells us.
// This is how gcc tells us.
#if defined(__SANITIZE_ADDRESS__)
#if defined(__SANITIZE_ADDRESS__)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment