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

[WIP] CI: debug clang thread sanitizer errors #5492

Open
wants to merge 9 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
48 changes: 25 additions & 23 deletions .github/workflows/clang_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ jobs:
build_thread_sanitizer:
name: Clang thread sanitizer
runs-on: ubuntu-24.04
# TODO Fix data race conditions and re-enable job
if: 0 #github.event.pull_request.draft == false
if: github.event.pull_request.draft == false
env:
CC: clang
CXX: clang++
Expand All @@ -88,7 +87,7 @@ jobs:
- uses: actions/checkout@v4
- name: install dependencies
run: |
.github/workflows/dependencies/clang17.sh
.github/workflows/dependencies/clang.sh 17
- name: CCache Cache
uses: actions/cache@v4
with:
Expand All @@ -105,13 +104,16 @@ jobs:

export CXX=$(which clang++-17)
export CC=$(which clang-17)
export CXXFLAGS="-fsanitize=thread"
# Ensure that compiler uses libc++ and libomp
export CXXFLAGS="-fsanitize=thread -stdlib=libc++ -fopenmp=libomp"
# Ensure that linker uses libc++ and links against libomp
export LDFLAGS="-stdlib=libc++ -L/usr/lib/llvm-17/lib -lomp"

cmake -S . -B build \
-GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWarpX_DIMS="RZ;1;2;3" \
-DCMAKE_BUILD_TYPE=Debug \
-DWarpX_DIMS="1" \
-DWarpX_FFT=ON \
-DWarpX_QED=ON \
-DWarpX_QED_TABLE_GEN=ON \
Expand All @@ -121,19 +123,19 @@ jobs:
-DWarpX_PARTICLE_PRECISION=DOUBLE
cmake --build build -j 4

cmake -S . -B build_EB \
-GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWarpX_DIMS="2" \
-DWarpX_FFT=ON \
-DWarpX_QED=ON \
-DWarpX_QED_TABLE_GEN=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_EB=ON \
-DWarpX_PRECISION=DOUBLE \
-DWarpX_PARTICLE_PRECISION=DOUBLE
cmake --build build_EB -j 4
#cmake -S . -B build_EB \
# -GNinja \
# -DCMAKE_VERBOSE_MAKEFILE=ON \
# -DCMAKE_BUILD_TYPE=RelWithDebInfo \
# -DWarpX_DIMS="2" \
# -DWarpX_FFT=ON \
# -DWarpX_QED=ON \
# -DWarpX_QED_TABLE_GEN=ON \
# -DWarpX_OPENPMD=ON \
# -DWarpX_EB=ON \
# -DWarpX_PRECISION=DOUBLE \
# -DWarpX_PARTICLE_PRECISION=DOUBLE
#cmake --build build_EB -j 4

ccache -s
du -hs ~/.cache/ccache
Expand All @@ -146,14 +148,14 @@ jobs:

export OMP_NUM_THREADS=2

mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz warpx.serialize_initial_conditions = 0
#mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_base_1d warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_base_2d warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_base_3d warpx.serialize_initial_conditions = 0
#mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_base_2d warpx.serialize_initial_conditions = 0
#mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_base_3d warpx.serialize_initial_conditions = 0

git clone https://github.com/ECP-WarpX/warpx-data ../warpx-data
cd Examples/Tests/embedded_circle

ulimit -c unlimited

mpirun -n 2 ../../../build_EB/bin/warpx.2d inputs_test_2d_embedded_circle warpx.serialize_initial_conditions = 0
#mpirun -n 2 ../../../build_EB/bin/warpx.2d inputs_test_2d_embedded_circle warpx.serialize_initial_conditions = 0
71 changes: 71 additions & 0 deletions .github/workflows/dependencies/clang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# Copyright 2024 The WarpX Community
#
# License: BSD-3-Clause-LBNL

set -eu -o pipefail

# `man apt.conf`:
# Number of retries to perform. If this is non-zero APT will retry
# failed files the given number of times.
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries

# This dependency file is currently used within a docker container,
# which does not come (among others) with wget, xz-utils, curl, git,
# ccache, and pkg-config pre-installed.
sudo apt-get -qq update
sudo apt-get install -y \
cmake \
libblas-dev \
libc++-17-dev \
libboost-math-dev \
libfftw3-dev \
libfftw3-mpi-dev \
libhdf5-openmpi-dev \
liblapack-dev \
libopenmpi-dev \
libomp-17-dev \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to set CXXFLAGS so we use the LLVM stdlib (libc++) and the LLVM OpenMP lib (libomp).

On Ubuntu, we think clang is configured to by default use the GNU libs for compatibility.

ninja-build \
wget \
xz-utils \
curl \
git \
ccache \
pkg-config

# parse clang version from command line
version_number=${1}
# add LLVM repository and install clang tools
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${version_number}
sudo apt-get update
sudo apt-get install clang-${version_number} clang-tidy-${version_number}
# export compiler flags
export CXX=$(which clang++-${version_number})
export CC=$(which clang-${version_number})

# cmake-easyinstall
#
sudo curl -L -o /usr/local/bin/cmake-easyinstall https://raw.githubusercontent.com/ax3l/cmake-easyinstall/main/cmake-easyinstall
sudo chmod a+x /usr/local/bin/cmake-easyinstall
export CEI_SUDO="sudo"
export CEI_TMP="/tmp/cei"

# BLAS++ & LAPACK++
cmake-easyinstall \
--prefix=/usr/local \
git+https://github.com/icl-utk-edu/blaspp.git \
-Duse_openmp=OFF \
-Dbuild_tests=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_VERBOSE_MAKEFILE=ON

cmake-easyinstall \
--prefix=/usr/local \
git+https://github.com/icl-utk-edu/lapackpp.git \
-Duse_cmake_find_lapack=ON \
-Dbuild_tests=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_VERBOSE_MAKEFILE=ON
Loading