Skip to content

Commit

Permalink
Merge pull request #57 from STEllAR-GROUP/hpxmpInhpx
Browse files Browse the repository at this point in the history
Fix building when build with '-DHPX_WITH_HPXMP=ON' in HPX
  • Loading branch information
tianyizhangcs committed Oct 17, 2019
2 parents 4a652eb + d901eab commit 4c0d53b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 41 deletions.
4 changes: 2 additions & 2 deletions examples/ompt/CMakeLists.txt
Expand Up @@ -5,6 +5,6 @@

if(HPXMP_WITH_OMPT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
add_executable(ex_ompt_hello_world hello_world.cpp)
add_executable(ex_ompt_task task_ex.cpp)
add_executable(examples.ompt.hello_world hello_world.cpp)
add_executable(examples.ompt.task task_ex.cpp)
endif()
2 changes: 1 addition & 1 deletion examples/openmp/CMakeLists.txt
Expand Up @@ -5,5 +5,5 @@

if(HPXMP_WITH_OMPT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
add_executable(ex_hello_world hello_world.cpp)
add_executable(examples.omp.hello_world hello_world.cpp)
endif()
13 changes: 7 additions & 6 deletions src/gcc_hpxMP.cpp
Expand Up @@ -291,7 +291,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
int func( \
long lb, long ub, long str, long chunk_sz, long *p_lb, long *p_ub) \
{ \
int status; \
int status = 0; \
long stride; \
int gtid = hpx_backend->get_thread_num(); \
if ((str > 0) ? (lb < ub) : (lb > ub)) \
Expand All @@ -315,7 +315,7 @@ xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
#define LOOP_RUNTIME_START(func, schedule) \
int func(long lb, long ub, long str, long *p_lb, long *p_ub) \
{ \
int status; \
int status = 0; \
long stride; \
long chunk_sz = 0; \
int gtid = hpx_backend->get_thread_num(); \
Expand Down Expand Up @@ -439,7 +439,7 @@ xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void) {
unsigned long long str, unsigned long long chunk_sz, \
unsigned long long *p_lb, unsigned long long *p_ub) \
{ \
int status; \
int status = 0; \
long long str2 = up ? ((long long) str) : -((long long) str); \
long long stride; \
int gtid = hpx_backend->get_thread_num(); \
Expand All @@ -466,7 +466,7 @@ xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void) {
unsigned long long str, unsigned long long *p_lb, \
unsigned long long *p_ub) \
{ \
int status; \
int status = 0; \
long long str2 = up ? ((long long) str) : -((long long) str); \
unsigned long long stride; \
unsigned long long chunk_sz = 0; \
Expand Down Expand Up @@ -581,15 +581,16 @@ xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_fu
if (gomp_flags & 8) {
const size_t ndeps = (kmp_intptr_t) depend[0];
const size_t nout = (kmp_intptr_t) depend[1];
kmp_depend_info_t dep_list[ndeps];
vector<kmp_depend_info_t> dep_list;
dep_list.reserve(ndeps);

for (size_t i = 0U; i < ndeps; i++) {
dep_list[i].base_addr = (kmp_intptr_t) depend[2U + i];
dep_list[i].len = 0U;
dep_list[i].flags.in = 1;
dep_list[i].flags.out = (i < nout);
}
__kmpc_omp_task_with_deps(nullptr, gtid, task, ndeps, dep_list, 0, NULL);
__kmpc_omp_task_with_deps(nullptr, gtid, task, ndeps, &dep_list[0], 0, NULL);
} else {
__kmpc_omp_task(nullptr, gtid, task);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hpx_runtime.h
Expand Up @@ -271,7 +271,7 @@ class omp_task_data {

//This is for explicit tasks
omp_task_data(int tid, parallel_region *T, omp_icv icv_vars)
: local_thread_num(tid), team(T), icv(icv_vars),taskLatch(0)
: local_thread_num(tid), team(T), taskLatch(0), icv(icv_vars)
{
threads_requested = icv.nthreads;
icv_vars.device = icv.device;
Expand Down
4 changes: 2 additions & 2 deletions tests/ompt/CMakeLists.txt
Expand Up @@ -37,7 +37,7 @@ if(HPXMP_WITH_OMPT)

foreach(test ${tests})
set(sources ${test}.cpp)
add_executable(${test} ${sources})
do_test(${test})
add_executable(tests.omp.${test} ${sources})
do_test(tests.omp.${test})
endforeach()
endif()
4 changes: 2 additions & 2 deletions tests/openmp/regressions/CMakeLists.txt
Expand Up @@ -28,6 +28,6 @@ endmacro(do_test)

foreach(test ${tests})
set(sources ${test}.cpp)
add_executable(${test} ${sources})
do_test(${test})
add_executable(tests.omp.regression.${test} ${sources})
do_test(tests.omp.regression.${test})
endforeach()
31 changes: 4 additions & 27 deletions tests/openmp/unit/CMakeLists.txt
Expand Up @@ -53,45 +53,22 @@ macro(do_test name)
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
#maybe make the omp_num_threads configurable later
set_tests_properties(${name} PROPERTIES
ENVIRONMENT "LD_PRELOAD=${PROJECT_BINARY_DIR}/libhpxmp.so;OMP_NUM_THREADS=2"
TIMEOUT 50
)
endmacro(do_test)

macro(do_test_enhanced name)
add_test(${name} ${name})
set_target_properties(${name} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
#maybe make the omp_num_threads configurable later
set_tests_properties(${name} PROPERTIES
ENVIRONMENT "LD_PRELOAD=${PROJECT_BINARY_DIR}/libhpxmp.so;OMP_NUM_THREADS=2"
TIMEOUT 60
)
endmacro(do_test_enhanced)



foreach(test ${tests})
set(sources ${test}.cpp)
add_executable(${test} ${sources})
do_test(${test})
endforeach()

foreach(test ${tests_enhanced})
set(sources ${test}.cpp)
add_executable(${test} ${sources})
do_test_enhanced(${test})
add_executable(tests.omp.unit.${test} ${sources})
do_test(tests.omp.unit.${test})
endforeach()

if(HPXMP_WITH_OMP_50_ENABLED)
foreach(test ${tests_omp50})
set(sources ${test}.cpp)
add_executable(${test} ${sources})
do_test_enhanced(${test})
add_executable(tests.omp.unit.${test} ${sources})
do_test(tests.omp.unit.${test})
endforeach()
endif()

0 comments on commit 4c0d53b

Please sign in to comment.