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

197 reduction operation being executed in parallel with read modify write operation in onesourcegeneratepdf #209

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

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

yes the comments are mixed up. How do you want to proceed?

Copy link
Member

Choose a reason for hiding this comment

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

I can edit directly in the branch on github

Copy link
Author

Choose a reason for hiding this comment

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

I'll just amend the commit and send version 3 then.

Copy link
Member

Choose a reason for hiding this comment

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

I just merged a fix to the file, I think we can go with that no?

Copy link
Author

Choose a reason for hiding this comment

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

No, you merged it to the other pull request, which was increased now to 12 commits. I've fixed the second commit and we still have only two in this pull request, that's the idea.

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ else()
add_compile_options("-mno-vzeroupper" "-mavx2" "-floop-unroll-and-jam" )
endif()

# only set these flags if testing presence of race conditions :
# https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual
# on linux/gcc it seems that one needs to run with LD_PRELOAD=/lib/x86_64-linux-gnu/libtsan.so.0 prepended
# and do a `sudo sysctl vm.mmap_rnd_bits=28` prior to running
if(DEFINED ENV{SANITIZE_THREAD})
message(STATUS "Building with thread sanitizing enabled.")
SET(GCC_COVERAGE_COMPILE_FLAGS "-g -O2 -fsanitize=thread")
SET(GCC_COVERAGE_LINK_FLAGS "-fsanitize=thread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
endif()

if(DEFINED ENV{INCLUDE_COVERAGE} AND DEFINED ENV{SANITIZE_ADDRESS})
message(FATAL_ERROR "Conflicting build options: INCLUDE_COVERAGE and SANITIZE_ADDRESS")
endif()
Expand All @@ -72,9 +84,9 @@ endif()
if(DEFINED ENV{INCLUDE_COVERAGE})
message(STATUS "Building with code coverage enabled.")
SET(GCC_COVERAGE_COMPILE_FLAGS "-g -O0 -coverage -fprofile-arcs -ftest-coverage")
SET(GCC_COVERAGE_LINK_FLAGS "-coverage -lgcov")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" )
SET(GCC_COVERAGE_LINK_FLAGS "-coverage -lgcov -lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
endif()

# Enable the address sanitizer with an environment variable.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/onesource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,8 @@ void onesource::generatePDF(vector<SED *> &fulllib, const vector<size_t> &va,
// Catch the name of the local thread in the parallelisation
thread_id = omp_get_thread_num();
#pragma omp for schedule(static, 10000) reduction( \
+ : PDFzloc, PDFzqloc, PDFmassloc, PDFSFRloc, PDFsSFRloc, PDFAgeloc) \
nowait
+ : PDFzloc, PDFzqloc, PDFmassloc, PDFSFRloc, PDFsSFRloc, PDFAgeloc, \
PDFLdustloc, PDFcol1loc, PDFcol2loc, PDFmrefloc) nowait
#endif
// Loop over all SEDs, which is parallelized
for (size_t i = 0; i < va.size(); i++) {
Expand Down
Loading