diff --git a/bootstrap-configs/bootstrap-macbook.sh b/bootstrap-configs/bootstrap-macbook.sh index 0504d646..52832ab1 100755 --- a/bootstrap-configs/bootstrap-macbook.sh +++ b/bootstrap-configs/bootstrap-macbook.sh @@ -19,6 +19,7 @@ unset TAU_ROOT # other CMake variables - for special situations / architectures / compilers. cmake_build_type="-DCMAKE_BUILD_TYPE=Debug -DAPEX_DEBUG=TRUE -DBUILD_TESTS=TRUE -DBUILD_EXAMPLES=TRUE" # Debug, Release, RelWithDebInfo, etc. +#cmake_build_type="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DAPEX_DEBUG=FALSE -DBUILD_TESTS=TRUE -DBUILD_EXAMPLES=TRUE" # Debug, Release, RelWithDebInfo, etc. cmake_apex_throttle="-DAPEX_THROTTLE=FALSE" # TRUE or FALSE cmake_build_shared_libs="-DBUILD_SHARED_LIBS=TRUE" # TRUE or FALSE cmake_install_prefix="-DCMAKE_INSTALL_PREFIX=../install" # the installation path @@ -28,6 +29,7 @@ cmake_install_prefix="-DCMAKE_INSTALL_PREFIX=../install" # the installation path cmake_make_verbose="" # for verbose, use -DCMAKE_VERBOSE_MAKEFILE=ON cmake_use_mpi="-DUSE_MPI=FALSE" # TRUE or FALSE cmake_other_settings="-DMPI_C_COMPILER=mpicc -DMPI_CXX_COMPILER=mpicxx -DOTF2_ROOT=$HOME/install/otf2/2.0" # anything else? +#cmake_other_settings="-DMPI_C_COMPILER=mpicc -DMPI_CXX_COMPILER=mpicxx" # anything else? # runtime parameters for testing APEX with "make test" diff --git a/src/examples/CountCalls/count_calls.cpp b/src/examples/CountCalls/count_calls.cpp index a110b252..50c8cb54 100644 --- a/src/examples/CountCalls/count_calls.cpp +++ b/src/examples/CountCalls/count_calls.cpp @@ -40,7 +40,8 @@ uint64_t do_work(uint64_t work) { void* someThread(void* tmp) { UNUSED(tmp); - apex::self_stopping_timer proxy((apex_function_address)someThread, "threadTest thread"); + apex::scoped_thread ast("threadTest thread"); + apex::scoped_timer proxy((apex_function_address)someThread); #if defined (__APPLE__) printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); #else @@ -57,7 +58,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { apex::init(argv[0], 0, 1); - apex::self_stopping_timer proxy((apex_function_address)main); + apex::scoped_timer proxy((apex_function_address)main); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/examples/TestGetPower/getpower.cpp b/src/examples/TestGetPower/getpower.cpp index acc2f7d8..75d0adcb 100644 --- a/src/examples/TestGetPower/getpower.cpp +++ b/src/examples/TestGetPower/getpower.cpp @@ -12,7 +12,8 @@ void* someThread(void* tmp) { UNUSED(tmp); - apex::self_stopping_timer proxy((apex_function_address)someThread, "threadTest thread"); + apex::scoped_thread ast("threadTest thread"); + apex::scoped_timer proxy((apex_function_address)someThread); printf("PID of this process: %d\n", getpid()); #if defined (__APPLE__) printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); @@ -26,7 +27,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { apex::init(argv[0], 0, 1); - apex::self_stopping_timer proxy((apex_function_address)main); + apex::scoped_timer proxy((apex_function_address)main); double currentpower = apex::current_power_high(); printf("Power at start: %f Watts\n", currentpower); printf("PID of this process: %d\n", getpid()); diff --git a/src/examples/TestThreads/testThreads.cpp b/src/examples/TestThreads/testThreads.cpp index 2b5c518c..2be614fd 100644 --- a/src/examples/TestThreads/testThreads.cpp +++ b/src/examples/TestThreads/testThreads.cpp @@ -12,7 +12,8 @@ void* someThread(void* tmp) { UNUSED(tmp); - apex::self_stopping_timer proxy((apex_function_address)someThread, "threadTest thread"); + apex::scoped_thread ast("threadTest thread"); + apex::scoped_timer proxy((apex_function_address)someThread); printf("PID of this process: %d\n", getpid()); #if defined (__APPLE__) printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); @@ -26,7 +27,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { apex::init(argv[0], 0, 1); - apex::self_stopping_timer proxy((apex_function_address)main); + apex::scoped_timer proxy((apex_function_address)main); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/unit_tests/C++/CMakeLists.txt b/src/unit_tests/C++/CMakeLists.txt index 21a67960..6f3af4fc 100644 --- a/src/unit_tests/C++/CMakeLists.txt +++ b/src/unit_tests/C++/CMakeLists.txt @@ -36,8 +36,8 @@ set(example_programs apex_hpx_direct_actions apex_hpx_task_wrapper_direct_actions apex_profiler_guids + apex_fibonacci_std_async ) - #apex_fibonacci_std_async #apex_set_thread_cap #apex_setup_power_cap_throttling #apex_setup_custom_tuning diff --git a/src/unit_tests/C++/apex_current_power_high.cpp b/src/unit_tests/C++/apex_current_power_high.cpp index 3459f9b2..a671fb8e 100644 --- a/src/unit_tests/C++/apex_current_power_high.cpp +++ b/src/unit_tests/C++/apex_current_power_high.cpp @@ -12,7 +12,8 @@ void* someThread(void* tmp) { UNUSED(tmp); - apex::self_stopping_timer proxy((uint64_t)&someThread, "threadTest thread"); + apex::scoped_thread ast("threadTest thread"); + apex::scoped_timer proxy((uint64_t)&someThread); printf("PID of this process: %d\n", getpid()); #if defined (__APPLE__) printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); @@ -26,7 +27,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { apex::init(NULL, 0, 1); - apex::self_stopping_timer proxy((apex_function_address)main); + apex::scoped_timer proxy((apex_function_address)main); double currentpower = apex::current_power_high(); printf("Power at start: %f Watts\n", currentpower); printf("PID of this process: %d\n", getpid()); diff --git a/src/unit_tests/C++/apex_fibonacci_std_async.cpp b/src/unit_tests/C++/apex_fibonacci_std_async.cpp index 53d59080..abb42005 100644 --- a/src/unit_tests/C++/apex_fibonacci_std_async.cpp +++ b/src/unit_tests/C++/apex_fibonacci_std_async.cpp @@ -7,8 +7,9 @@ #define FIB_RESULTS_PRE 41 int fib_results[FIB_RESULTS_PRE] = {0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155}; -int fib (int in) { - apex::self_stopping_timer foo((void*)&fib, "fib thread"); +int fib (int in, apex::task_wrapper * parent) { + apex::scoped_thread st("fib thread"); + apex::scoped_timer ast((uint64_t)&fib, parent); if (in == 0) { return 0; } @@ -16,14 +17,17 @@ int fib (int in) { return 1; } int a = in-1; - auto future_a = std::async(std::launch::async, fib, a); + auto future_a = std::async(std::launch::async, fib, a, ast.get_task_wrapper()); int b = in-2; - auto future_b = std::async(std::launch::async, fib, b); + auto future_b = std::async(std::launch::async, fib, b, ast.get_task_wrapper()); + //apex::yield(twp); int result_a = future_a.get(); int result_b = future_b.get(); - return (result_a + result_b); + //apex::start(twp); + int result = result_a + result_b; + return result; } int main(int argc, char *argv[]) { @@ -46,7 +50,7 @@ int main(int argc, char *argv[]) { return -1; } - auto future = std::async(fib, i); + auto future = std::async(fib, i, nullptr); int result = future.get(); std::cout << "fib of " << i << " is " << result << " (valid value: " << fib_results[i] << ")" << std::endl; apex::finalize(); diff --git a/src/unit_tests/C++/apex_hpx_direct_actions.cpp b/src/unit_tests/C++/apex_hpx_direct_actions.cpp index f51212ba..1ae92de7 100644 --- a/src/unit_tests/C++/apex_hpx_direct_actions.cpp +++ b/src/unit_tests/C++/apex_hpx_direct_actions.cpp @@ -113,7 +113,7 @@ void* someThread(void* tmp) /* Register this thread with APEX */ int* tid = (int*)tmp; char name[32]; - sprintf(name, "worker thread %d", *tid); + sprintf(name, "worker-thread %d", *tid); #ifndef __APPLE__ #ifndef APEX_HAVE_OTF2 pthread_barrier_wait(&barrier); diff --git a/src/unit_tests/C++/apex_new_task.cpp b/src/unit_tests/C++/apex_new_task.cpp index 53e3cef5..3704dd62 100644 --- a/src/unit_tests/C++/apex_new_task.cpp +++ b/src/unit_tests/C++/apex_new_task.cpp @@ -11,7 +11,8 @@ int fib_results[FIB_RESULTS_PRE] = {0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610 std::atomic task_id(-1); int fib (int in) { - apex::self_stopping_timer foo((uint64_t)&fib, "fib thread"); + apex::scoped_thread ast("fib thread"); + apex::scoped_timer foo((uint64_t)&fib); if (in == 0) { return 0; } @@ -35,7 +36,7 @@ int fib (int in) { int main(int argc, char *argv[]) { apex::init("apex_new_task_cpp unit test", 0, 1); - apex::self_stopping_timer foo((uint64_t)&main); + apex::scoped_timer foo((uint64_t)&main); #if defined(APEX_HAVE_TAU) || (APEX_HAVE_OTF2) int i = 5; #else diff --git a/src/unit_tests/C++/apex_pthread_flood.cpp b/src/unit_tests/C++/apex_pthread_flood.cpp index e85b3371..46b4ad74 100644 --- a/src/unit_tests/C++/apex_pthread_flood.cpp +++ b/src/unit_tests/C++/apex_pthread_flood.cpp @@ -36,19 +36,18 @@ typedef void*(*start_routine_t)(void*); void* someThread(void* tmp) { + apex::scoped_thread("threadTest thread"); unsigned long * result = (unsigned long *)tmp; - apex::register_thread("threadTest thread"); int i = 0; unsigned long total = 0; { // only time this for loop - apex::self_stopping_timer proxy((apex_function_address)someThread); + apex::scoped_timer proxy((apex_function_address)someThread); for (i = 0 ; i < ITERATIONS ; i++) { apex::profiler * p = apex::start((apex_function_address)foo); total += foo(i); apex::stop(p); } } - apex::exit_thread(); *result = total; return NULL; } @@ -63,7 +62,7 @@ int main(int argc, char **argv) apex::apex_options::use_screen_output(true); sleep(1); // if we don't sleep, the proc_read thread won't have time to read anything. - apex::self_stopping_timer proxy((apex_function_address)main); + apex::scoped_timer proxy((apex_function_address)main); printf("PID of this process: %d\n", getpid()); std::cout << "Expecting " << numthreads << " threads." << std::endl; pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * numthreads)); diff --git a/src/unit_tests/C++/apex_task_wrapper.cpp b/src/unit_tests/C++/apex_task_wrapper.cpp index 496832ac..f340b30b 100644 --- a/src/unit_tests/C++/apex_task_wrapper.cpp +++ b/src/unit_tests/C++/apex_task_wrapper.cpp @@ -39,7 +39,7 @@ int fib (int in, apex::task_wrapper * tt) { int main(int argc, char *argv[]) { apex::init("apex_new_task_cpp unit test", 0, 1); - apex::self_stopping_timer foo((uint64_t)&main); + apex::scoped_timer foo((uint64_t)&main); #if defined(APEX_HAVE_TAU) || (APEX_HAVE_OTF2) int i = 5; #else