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

Improve thread-safety in DART #252

Merged
merged 25 commits into from
Feb 13, 2017
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a5401c2
Check availability of __sync functions and provide unsafe alternatives
devreal Feb 6, 2017
92c1802
Use [DART|DASH]_ENABLE_THREADSUPPORT and DART_HAVE_PTHREADS guards
devreal Feb 6, 2017
b5f0f95
dart_thread_level_t -> dart_thread_support_level_t
devreal Feb 6, 2017
e4c4842
Add missing CMake changes
devreal Feb 6, 2017
f25d6f9
Fix fall-back surrogates used if thread-support is disabled
devreal Feb 6, 2017
d20ebf4
Remove dash::check_summa_pattern_constraints
devreal Feb 6, 2017
c29ff99
Fix path to dash-ci.sh script in CI documentation
devreal Feb 6, 2017
591da1d
Merge branch 'development' into bug-118-threadsafety
fuchsto Feb 10, 2017
188fb6b
Disable GCC warning for EXPECT_EQ_U
devreal Feb 10, 2017
a96f3ce
Merge branch 'development' into bug-118-threadsafety
fuchsto Feb 10, 2017
94c47f5
Fix debug output for thread-support status
devreal Feb 10, 2017
378f014
Fix compiler warning about initialization ordering
devreal Feb 10, 2017
77a3280
Add trace output for team create
devreal Feb 10, 2017
293e510
Extend thread-safety tests to include parallel mem register
devreal Feb 10, 2017
8a265c0
BUG: Fix an issue with the conversion from global to local unit IDs i…
devreal Feb 13, 2017
88ae3c0
Add dash::memfree and check return value of dart_memalloc in dash::me…
devreal Feb 13, 2017
5d58ffa
Add test for concurrent calls to dart_memalloc
devreal Feb 13, 2017
196a60f
Fix fix for team-based unit IDs in shared memory get
devreal Feb 13, 2017
555773f
Add test case for concurrent dash::Algorithm invocation
devreal Feb 13, 2017
20061d0
Merge branch 'bug-118-threadsafety' of github.com:dash-project/dash i…
devreal Feb 13, 2017
5ba4ce2
Fix braces in DART_FETCH_AND_DECPTR
devreal Feb 13, 2017
4e6e081
Merge branch 'development' into bug-118-threadsafety
fuchsto Feb 13, 2017
76e59cc
Merge branch 'development' into bug-118-threadsafety
fuchsto Feb 13, 2017
459d416
Use DASH_ENABLE_OPENMP to guard OpenMP statements
devreal Feb 13, 2017
eba464a
Merge branch 'bug-118-threadsafety' of github.com:dash-project/dash i…
devreal Feb 13, 2017
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
11 changes: 11 additions & 0 deletions CMakeExt/Code/test_builtin_sync.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


int main(int argc, char **argv)
{
int val = 0;
int res = __sync_add_and_fetch(&val, 1);

if (res != 1) return 1;

return 0;
}
41 changes: 30 additions & 11 deletions CMakeExt/Threading.cmake
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
## Flags to enabel support for multi-threading
## Flags to enable support for multi-threading

##
# At the moment, ENABLE_THREADING enables DART_THREADING_PTHREADS since
# At the moment, DART_ENABLE_THREADSUPPORT enables DART_HAVE_PTHREADS since
# Pthreads are the only threading implementation currently supported.
##

if (ENABLE_THREADING)
if (ENABLE_THREADSUPPORT)

MESSAGE(STATUS "Checking for builtin __sync_add_and_fetch")
TRY_COMPILE(DART_SYNC_BUILTINS ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/CMakeExt/Code/test_builtin_sync.c
OUTPUT_VARIABLE OUTPUT)
if (DART_SYNC_BUILTINS)
MESSAGE(STATUS "Found builtin __sync_add_and_fetch")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS_RELEASE} -DDART_HAVE_SYNC_BUILTINS")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS_RELEASE} -DDART_HAVE_SYNC_BUILTINS")
else()
# error out for now
MESSAGE(STATUS "Compiling builtin __sync_add_and_fetch failed with error "
${OUTPUT})
message(FATAL_ERROR "Support for builtin __sync atomics required if "
"building with thread support enabled!")
endif()

# Find support for pthreads
find_package(Threads REQUIRED)
set(CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} -pthread -DDART_ENABLE_THREADING -DDART_THREADING_PTHREADS -DDASH_ENABLE_THREADING")
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -pthread -DDART_ENABLE_THREADING -DDART_THREADING_PTHREADS -DDASH_ENABLE_THREADING")
set(CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} -pthread -DDART_ENABLE_THREADING -DDART_THREADING_PTHREADS -DDASH_ENABLE_THREADING")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -pthread -DDART_ENABLE_THREADING -DDART_THREADING_PTHREADS -DDASH_ENABLE_THREADING")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -pthread -DDART_ENABLE_THREADSUPPORT")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DDART_HAVE_PTHREADS -DDASH_ENABLE_THREADSUPPORT")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -pthread -DDART_ENABLE_THREADSUPPORT")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DDART_HAVE_PTHREADS -DDASH_ENABLE_THREADSUPPORT")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -pthread")

endif()
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ option(ENABLE_HDF5
"Specify whether HDF5 features are enabled" on)
option(ENABLE_NASTYMPI
"Specify whether the NastyMPI proxy should be enabled" off)
option(ENABLE_THREADING
option(ENABLE_THREADSUPPORT
"Specify whether support for multithreading should be compiled" off)

if (BUILD_COVERAGE_TESTS)
Expand Down Expand Up @@ -131,7 +131,7 @@ endif()
if (ENABLE_NASTYMPI)
include(${CMAKE_SOURCE_DIR}/CMakeExt/NastyMPI.cmake)
endif()
if (ENABLE_THREADING)
if (ENABLE_THREADSUPPORT)
include(${CMAKE_SOURCE_DIR}/CMakeExt/Threading.cmake)
endif()

Expand Down Expand Up @@ -289,8 +289,8 @@ message(INFO "HDF5 support: (ENABLE_HDF5) "
${ENABLE_HDF5})
message(INFO "Enabled DART backends: (DART_IMPLEMENTATIONS) "
${DART_IMPLEMENTATIONS})
message(INFO "Enable multithreading: (ENABLE_MULTITHREADING) "
${ENABLE_MULTITHREADING})
message(INFO "Enable multithreading: (ENABLE_THREADSUPPORT) "
${ENABLE_THREADSUPPORT})
message(INFO "C compiler id: ${CMAKE_C_COMPILER_ID}")
message(INFO "C++ compiler id: ${CMAKE_CXX_COMPILER_ID}")
if (MPI_FOUND)
Expand Down
1 change: 1 addition & 0 deletions build.cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0/ \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADSUPPORT=ON \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=OFF \
-DENABLE_LT_OPTIMIZATION=OFF \
-DENABLE_ASSERTIONS=ON \
Expand Down
1 change: 1 addition & 0 deletions build.dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0-dev/ \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADSUPPORT=ON \
-DENABLE_ASSERTIONS=ON \
-DENABLE_LT_OPTIMIZATION=OFF \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=ON \
Expand Down
1 change: 1 addition & 0 deletions build.mic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0-mic/ \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADSUPPORT=ON \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=OFF \
-DENABLE_EXTENDED_COMPILER_WARNINGS=OFF \
-DENABLE_ASSERTIONS=OFF \
Expand Down
1 change: 1 addition & 0 deletions build.minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0/ \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADSUPPORT=OFF \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=OFF \
-DENABLE_EXTENDED_COMPILER_WARNINGS=OFF \
-DENABLE_LT_OPTIMIZATION=OFF \
Expand Down
1 change: 1 addition & 0 deletions build.nasty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0-nasty \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADSUPPORT=ON \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=OFF \
-DENABLE_EXTENDED_COMPILER_WARNINGS=OFF \
-DENABLE_LT_OPTIMIZATION=OFF \
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ rm -Rf $BUILD_DIR/*
-DDART_IF_VERSION=3.2 \
-DINSTALL_PREFIX=$HOME/opt/dash-0.3.0/ \
-DDART_IMPLEMENTATIONS=mpi \
-DENABLE_THREADING=ON \
-DENABLE_THREADSUPPORT=ON \
-DENABLE_DEVELOPER_COMPILER_WARNINGS=OFF \
-DENABLE_EXTENDED_COMPILER_WARNINGS=OFF \
-DENABLE_LT_OPTIMIZATION=OFF \
Expand Down
2 changes: 1 addition & 1 deletion dart-if/v3.2/include/dash/dart/if/dart_initialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dart_ret_t dart_init(int *argc, char ***argv);
dart_ret_t dart_init_thread(
int* argc,
char*** argv,
dart_thread_level_t * thread_safety);
dart_thread_support_level_t * thread_safety);

/**
* Finalize the DASH runtime.
Expand Down
2 changes: 1 addition & 1 deletion dart-if/v3.2/include/dash/dart/if/dart_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ typedef enum
* the underlying runtime.
*/
DART_THREAD_MULTIPLE = 10
} dart_thread_level_t;
} dart_thread_support_level_t;

/**
* Scopes of locality domains.
Expand Down
Loading