diff --git a/CMakeLists.txt b/CMakeLists.txt index a8b9dfde..f6cd1376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,13 @@ if (${CMAKE_MAJOR_VERSION} GREATER 2) endif() endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # using GCC + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + message(FATAL_ERROR "GCC version must be at least 4.9!") + endif() +endif() + #if (${CMAKE_MAJOR_VERSION} GREATER 2) # if (${CMAKE_MAJOR_VERSION} GREATER 1) # cmake_policy(SET CMP0054 OLD) @@ -201,51 +208,33 @@ if (DEFINED APEX_SANITIZE_THREAD AND APEX_SANITIZE_THREAD) endif (DEFINED APEX_SANITIZE_THREAD AND APEX_SANITIZE_THREAD) # set debug options +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=native -DNDEBUG -Wno-deprecated") - set(CMAKE_C_FLAGS_RELEASE "-Ofast -march=native -DNDEBUG -Wno-deprecated") - # using Clang - set(CXX_PEDANTIC_COMPILER_WARNINGS "-Werror -Wsometimes-uninitialized -fdiagnostics-show-option -Wall -Wcast-align -Wcast-qual -Werror=format -Werror=missing-braces -Werror=parentheses -Werror=reorder -Werror=return-type -Werror=sequence-point -Werror=sign-compare -Werror=uninitialized -Werror=vla -Wextra -Wformat=2 -Winit-self -Wno-attributes -Wno-cast-align -Wno-delete-non-virtual-dtor -Wno-format-nonliteral -Wno-ignored-qualifiers -Wno-sign-promo -Wno-strict-aliasing -Wno-unused-parameter -Wno-unused-variable -Wno-unused-local-typedefs -Wno-unused-parameter ") - set(C_PEDANTIC_COMPILER_WARNINGS "-Werror -Wsometimes-uninitialized -fdiagnostics-show-option -Wall -Wcast-align -Wcast-qual -Werror=format -Werror=missing-braces -Werror=parentheses -Werror=reorder -Werror=return-type -Werror=sequence-point -Werror=sign-compare -Werror=uninitialized -Werror=vla -Wextra -Wformat=2 -Winit-self -Wno-attributes -Wno-cast-align -Wno-format-nonliteral -Wno-ignored-qualifiers -Wno-strict-aliasing -Wno-unused-parameter -Wno-unused-variable -Wno-unused-local-typedefs -Wno-unused-parameter ") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 ${CXX_PEDANTIC_COMPILER_WARNINGS} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") - set(CMAKE_C_FLAGS_DEBUG "-g -O0 ${C_PEDANTIC_COMPILER_WARNINGS} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # using GCC - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) - message(FATAL_ERROR "GCC version must be at least 4.9!") - endif() +# --------------------------------------------------- +# Set pedantic error flags if available +# --------------------------------------------------- +include(CheckCXXCompilerFlag) - set(CXX_PEDANTIC_COMPILER_WARNINGS "-fdiagnostics-show-option -Wall -Wmaybe-uninitialized -Wcast-align -Wcast-qual -Wdouble-promotion -Werror=format -Werror=missing-braces -Werror=parentheses -Werror=reorder -Werror=return-type -Werror=sequence-point -Werror=sign-compare -Werror=trampolines -Werror=uninitialized -Werror=vla -Wextra -Wformat=2 -Winit-self -Wno-attributes -Wno-cast-align -Wno-delete-non-virtual-dtor -Wno-format-nonliteral -Wno-ignored-qualifiers -Wno-sign-promo -Wno-strict-aliasing -Wno-sync-nand -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-unused-parameter ") - set(C_PEDANTIC_COMPILER_WARNINGS "-fdiagnostics-show-option -Wall -Wmaybe-uninitialized -Wcast-align -Wcast-qual -Wdouble-promotion -Werror=format -Werror=missing-braces -Werror=parentheses -Werror=reorder -Werror=return-type -Werror=sequence-point -Werror=sign-compare -Werror=trampolines -Werror=uninitialized -Werror=vla -Wextra -Wformat=2 -Winit-self -Wno-attributes -Wno-cast-align -Wno-format-nonliteral -Wno-ignored-qualifiers -Wno-strict-aliasing -Wno-sync-nand -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-unused-parameter ") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 ${CXX_PEDANTIC_COMPILER_WARNINGS} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") - set(CMAKE_C_FLAGS_DEBUG "-g -O0 ${C_PEDANTIC_COMPILER_WARNINGS} ${APEX_SANITIZE_OPTIONS} -DAPEX_ERROR_HANDLING") - # -march=native is broken on sandybridge architectures. - execute_process(COMMAND lscpu COMMAND grep Model: OUTPUT_VARIABLE CPUMODEL_STRING) - string(REPLACE " " ";" CPUMODEL_LIST ${CPUMODEL_STRING}) - list(LENGTH CPUMODEL_LIST CPUMODEL_LENGTH) - math(EXPR CPUMODEL_LENGTH "${CPUMODEL_LENGTH} - 1") - list(GET CPUMODEL_LIST ${CPUMODEL_LENGTH} CPUMODEL) - # message(STATUS "CPU Model: ${CPUMODEL}") - if(CPUMODEL EQUAL 63) - message(STATUS "Detected Sandybridge CPU - using special optimization flags") - SET(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=corei7-avx -mtune=corei7-avx -mno-avx -mno-aes -flto -DNDEBUG -Wno-deprecated") - SET(CMAKE_C_FLAGS_RELEASE "-Ofast -march=corei7-avx -mtune=corei7-avx -mno-avx -mno-aes -flto -DNDEBUG -Wno-deprecated") - else() - SET(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=native -flto -DNDEBUG -Wno-deprecated") - SET(CMAKE_C_FLAGS_RELEASE "-Ofast -march=native -flto -DNDEBUG -Wno-deprecated") - endif() - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -flto") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - # using Intel C++ - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 ") - set(CMAKE_C_FLAGS_DEBUG "-g -O0 ") - set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=native -ipo -DNDEBUG -Wno-deprecated") - set(CMAKE_C_FLAGS_RELEASE "-Ofast -march=native -ipo -DNDEBUG -Wno-deprecated") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -ipo") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # using Visual Studio C++ -endif() +function(enable_cxx_compiler_flag_if_supported flag) + string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${flag}" flag_supported) + if(flag_supported) + message(INFO " ${flag} supported by compiler, enabling it") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() + +# example usage +enable_cxx_compiler_flag_if_supported("-Wall") +enable_cxx_compiler_flag_if_supported("-Werror") +enable_cxx_compiler_flag_if_supported("-Wextra") +enable_cxx_compiler_flag_if_supported("-Wpedantic") +enable_cxx_compiler_flag_if_supported("-pedantic") +# --------------------------------------------------- # The version number. set (APEX_VERSION_MAJOR 2) diff --git a/etc/buildbot.sh b/etc/buildbot.sh index ed80c9e8..aab7335f 100755 --- a/etc/buildbot.sh +++ b/etc/buildbot.sh @@ -1,8 +1,11 @@ #!/bin/bash #set -x # echo all commands -source /usr/local/spack/share/spack/setup-env.sh -spack load cmake +host=`hostname` +if [ "$host" == "ktau" ] ; then + source /usr/local/spack/share/spack/setup-env.sh + spack load cmake +fi my_readlink() { @@ -19,7 +22,7 @@ my_readlink() TARGET=$(basename "$TARGET") done - # Compute the canonicalized name by finding the physical path + # Compute the canonicalized name by finding the physical path # for the directory we're in and appending the target file. DIR=`pwd -P` RESULT="$DIR/$TARGET" @@ -44,6 +47,15 @@ yes_ompt=" -DUSE_OMPT=TRUE -DOMPT_ROOT=/usr/local/ompt/5.0" yes_mpi=" -DUSE_MPI=TRUE" yes_papi=" -DUSE_PAPI=TRUE -DPAPI_ROOT=/usr" yes_tau=" -DUSE_TAU=TRUE -DTAU_ROOT=/usr/local/tau/git -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread" +if [ "$host" == "delphi" ] ; then + yes_bfd=" -DUSE_BFD=TRUE -DBFD_ROOT=/usr/local/packages/binutils/2.27" + yes_malloc=" -DUSE_JEMALLOC=TRUE -DJEMALLOC_ROOT=/usr/local/packages/jemalloc/5.0.1-gcc" + yes_ah=" -DUSE_ACTIVEHARMONY=TRUE -DACTIVEHARMONY_ROOT=/usr/local/packages/activeharmony/4.6.0-gcc -DUSE_PLUGINS=TRUE" + yes_otf=" -DUSE_OTF2=TRUE -DOTF2_ROOT=/usr/local/packages/otf2/2.1" + yes_ompt=" -DUSE_OMPT=TRUE -DOMPT_ROOT=/usr/local/packages/llvm-openmp/2020-03-25" + yes_papi=" -DUSE_PAPI=TRUE -DPAPI_ROOT=/usr/local/packages/papi/5.6.0" + yes_tau=" -DUSE_TAU=TRUE " +fi # set defaults build="default" @@ -56,12 +68,15 @@ sanitize="" ncores=2 osname=`uname` if [ ${osname} == "Darwin" ]; then -ncores=`sysctl -n hw.ncpu` -export CC=`which clang` -export CXX=`which clang++` -#cmake_generator="-G Xcode" + ncores=`sysctl -n hw.ncpu` + export CC=`which clang` + export CXX=`which clang++` + #cmake_generator="-G Xcode" else -ncores=`nproc --all` + # Get the true number of total cores, not threads. + ncoresper=`lscpu | grep -E '^Core' | awk '{print $NF}'` + nsockets=`lscpu | grep -E '^Socket' | awk '{print $NF}'` + let ncores=$ncoresper*$nsockets fi echo "Num parallel builds: $ncores" diff --git a/src/ITTNotify/ittnotify.cpp b/src/ITTNotify/ittnotify.cpp index ac03eadc..df910df1 100644 --- a/src/ITTNotify/ittnotify.cpp +++ b/src/ITTNotify/ittnotify.cpp @@ -146,43 +146,43 @@ void __itt_thread_set_name (const char * name) { apex::register_thread(string(name)); } -void __itt_sync_create(void*, const char*, const char*, int) { APEX_TRACER }; -void __itt_sync_rename(void*, const char*) { APEX_TRACER }; -void __itt_sync_prepare(void*) { APEX_TRACER }; -void __itt_sync_acquired(void*) { APEX_TRACER }; -void __itt_sync_cancel(void*) { APEX_TRACER }; -void __itt_sync_releasing(void*) { APEX_TRACER }; -void __itt_sync_destroy(void*) { APEX_TRACER }; -void __itt_thread_ignore() { APEX_TRACER }; +void __itt_sync_create(void*, const char*, const char*, int) { APEX_TRACER } +void __itt_sync_rename(void*, const char*) { APEX_TRACER } +void __itt_sync_prepare(void*) { APEX_TRACER } +void __itt_sync_acquired(void*) { APEX_TRACER } +void __itt_sync_cancel(void*) { APEX_TRACER } +void __itt_sync_releasing(void*) { APEX_TRACER } +void __itt_sync_destroy(void*) { APEX_TRACER } +void __itt_thread_ignore() { APEX_TRACER } __itt_heap_function __itt_heap_function_create(const char*, const char*) { -APEX_TRACER return nullptr; }; +APEX_TRACER return nullptr; } void __itt_heap_allocate_begin(__itt_heap_function, std::size_t, int) { -APEX_TRACER }; +APEX_TRACER } void __itt_heap_allocate_end(__itt_heap_function, void**, std::size_t, int) { -APEX_TRACER }; -void __itt_heap_free_begin(__itt_heap_function, void*) { APEX_TRACER }; -void __itt_heap_free_end(__itt_heap_function, void*) { APEX_TRACER }; +APEX_TRACER } +void __itt_heap_free_begin(__itt_heap_function, void*) { APEX_TRACER } +void __itt_heap_free_end(__itt_heap_function, void*) { APEX_TRACER } void __itt_heap_reallocate_begin(__itt_heap_function, void*, std::size_t, int) -{ APEX_TRACER }; +{ APEX_TRACER } void __itt_heap_reallocate_end(__itt_heap_function a, void* b, void** c, std::size_t d, int e) { APEX_TRACER ;APEX_UNUSED(a); APEX_UNUSED(b); -APEX_UNUSED(c); APEX_UNUSED(d); APEX_UNUSED(e); }; -void __itt_heap_internal_access_begin() { APEX_TRACER }; -void __itt_heap_internal_access_end() { APEX_TRACER }; +APEX_UNUSED(c); APEX_UNUSED(d); APEX_UNUSED(e); } +void __itt_heap_internal_access_begin() { APEX_TRACER } +void __itt_heap_internal_access_end() { APEX_TRACER } __itt_mark_type __itt_mark_create(char const* name) { APEX_TRACER ; -APEX_UNUSED(name); return 0; }; +APEX_UNUSED(name); return 0; } int __itt_mark_off(__itt_mark_type mark) { APEX_TRACER ; APEX_UNUSED(mark); -return 0; }; +return 0; } int __itt_mark(__itt_mark_type mark, char const* par) { APEX_TRACER ; -APEX_UNUSED(mark); APEX_UNUSED(par); return 0; }; -__itt_caller __itt_stack_caller_create() { APEX_TRACER return nullptr; }; +APEX_UNUSED(mark); APEX_UNUSED(par); return 0; } +__itt_caller __itt_stack_caller_create() { APEX_TRACER return nullptr; } void __itt_stack_callee_enter(__itt_caller ctx) { APEX_TRACER ; -APEX_UNUSED(ctx); }; +APEX_UNUSED(ctx); } void __itt_stack_callee_leave(__itt_caller ctx) { APEX_TRACER ; -APEX_UNUSED(ctx); }; +APEX_UNUSED(ctx); } void __itt_stack_caller_destroy(__itt_caller ctx) { APEX_TRACER ; -APEX_UNUSED(ctx); }; +APEX_UNUSED(ctx); } // assign some function pointers #if defined(_WIN32) || defined(_WIN64) diff --git a/src/apex/apex.cpp b/src/apex/apex.cpp index e7d725a7..4d4b5492 100644 --- a/src/apex/apex.cpp +++ b/src/apex/apex.cpp @@ -460,6 +460,7 @@ inline std::shared_ptr _new_task( task_identifier * id, const uint64_t task_id, const std::shared_ptr parent_task, apex* instance) { + APEX_UNUSED(instance); std::shared_ptr tt_ptr = make_shared(); tt_ptr->task_id = id; // if not tracking dependencies, don't save the parent @@ -1660,6 +1661,8 @@ apex_policy_handle * sample_runtime_counter(unsigned long period, const }); } #else + APEX_UNUSED(period); + APEX_UNUSED(counter_name); std::cerr << "WARNING: Runtime counter sampling is not implemented for your runtime" << std::endl; @@ -1785,6 +1788,7 @@ void send (uint64_t tag, uint64_t size, uint64_t target) { void recv (uint64_t tag, uint64_t size, uint64_t source_rank, uint64_t source_thread) { + APEX_UNUSED(source_thread); // if APEX is disabled, do nothing. if (apex_options::disable() == true) { return ; } // if APEX is suspended, do nothing. diff --git a/src/apex/apex_ompt.cpp b/src/apex/apex_ompt.cpp index 82c8fb57..c5e92b1f 100644 --- a/src/apex/apex_ompt.cpp +++ b/src/apex/apex_ompt.cpp @@ -117,9 +117,10 @@ void apex_ompt_stop(ompt_data_t * ompt_data) { /* Event #1, thread begin */ extern "C" void apex_thread_begin( - ompt_thread_t thread_type, /* type of thread */ - ompt_data_t *thread_data /* data of thread */ -) { + ompt_thread_t thread_type, /* type of thread */ + ompt_data_t *thread_data /* data of thread */) +{ + APEX_UNUSED(thread_data); { std::unique_lock l(apex_apex_threadid_mutex); apex_threadid = apex_numthreads++; @@ -161,6 +162,10 @@ static void apex_parallel_region_begin ( int flags, /* flags */ const void *codeptr_ra /* return address of runtime call */ ) { + APEX_UNUSED(encountering_task_data); + APEX_UNUSED(encountering_task_frame); + APEX_UNUSED(requested_team_size); + APEX_UNUSED(flags); char regionIDstr[128] = {0}; sprintf(regionIDstr, "OpenMP Parallel Region: UNRESOLVED ADDR %p", codeptr_ra); apex_ompt_start(regionIDstr, parallel_data, nullptr, true); @@ -177,6 +182,9 @@ static void apex_parallel_region_end ( int flags, /* flags */ const void *codeptr_ra /* return address of runtime call */ ) { + APEX_UNUSED(encountering_task_data); + APEX_UNUSED(flags); + APEX_UNUSED(codeptr_ra); //printf("%llu: Parallel Region End parent: %p, apex_parent: %p, region: //%p, apex_region: %p\n", apex_threadid, encountering_task_data, //encountering_task_data->ptr, parallel_data, parallel_data->ptr); @@ -193,6 +201,9 @@ extern "C" void apex_task_create ( int has_dependences, /* created task has dependences */ const void *codeptr_ra /* return address of runtime call */ ) { + APEX_UNUSED(encountering_task_frame); + APEX_UNUSED(has_dependences); + APEX_UNUSED(codeptr_ra); char * type_str; static const char * initial_str = "OpenMP Initial Task"; static const char * implicit_str = "OpenMP Implicit Task"; @@ -291,6 +302,8 @@ extern "C" void apex_implicit_task( unsigned int team_size, /* team size */ unsigned int thread_num /* thread number of calling thread */ ) { + APEX_UNUSED(team_size); + APEX_UNUSED(thread_num); if (endpoint == ompt_scope_begin) { apex_ompt_start("OpenMP Implicit Task", task_data, parallel_data, false); @@ -457,6 +470,7 @@ extern "C" void apex_ompt_work ( uint64_t count, /* quantity of work */ const void *codeptr_ra /* return address of runtime call */ ) { + APEX_UNUSED(count); char * tmp_str; static const char * loop_str = "Loop"; @@ -595,6 +609,7 @@ extern "C" void apex_ompt_flush ( ompt_data_t *thread_data, /* data of thread */ const void *codeptr_ra /* return address of runtime call */ ) { + APEX_UNUSED(thread_data); if (codeptr_ra != nullptr) { char regionIDstr[128] = {0}; sprintf(regionIDstr, "OpenMP Flush: UNRESOLVED ADDR %p", codeptr_ra); @@ -711,6 +726,7 @@ extern "C" { int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num, ompt_data_t* tool_data) { APEX_UNUSED(initial_device_num); + APEX_UNUSED(tool_data); { std::unique_lock l(apex_apex_threadid_mutex); apex_threadid = apex_numthreads++; @@ -865,12 +881,15 @@ int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num, void ompt_finalize(ompt_data_t* tool_data) { + APEX_UNUSED(tool_data); printf("OpenMP runtime is shutting down...\n"); apex::finalize(); } ompt_start_tool_result_t * ompt_start_tool( unsigned int omp_version, const char *runtime_version) { + APEX_UNUSED(omp_version); + APEX_UNUSED(runtime_version); static ompt_start_tool_result_t result; result.initialize = &ompt_initialize; result.finalize = &ompt_finalize; @@ -879,4 +898,4 @@ ompt_start_tool_result_t * ompt_start_tool( return &result; } -}; // extern "C" +} // extern "C" diff --git a/src/apex/apex_options.cpp b/src/apex/apex_options.cpp index 9e373caa..65a02efc 100644 --- a/src/apex/apex_options.cpp +++ b/src/apex/apex_options.cpp @@ -95,7 +95,7 @@ namespace apex free (_##member_variable); FOREACH_EXTERNAL_STRING_OPTION(apex_macro) #undef apex_macro - }; + } apex_options::~apex_options(void) { #define apex_macro(name, member_variable, type, default_value) \ diff --git a/src/apex/apex_policies.cpp b/src/apex/apex_policies.cpp index 8890353d..b1485c86 100644 --- a/src/apex/apex_policies.cpp +++ b/src/apex/apex_policies.cpp @@ -1262,8 +1262,12 @@ tuning_session) { #else inline void __apex_active_harmony_setup(shared_ptr - tuning_session) { } -inline void __apex_active_harmony_setup(apex_tuning_session * tuning_session) { } + tuning_session) { + APEX_UNUSED(tuning_session); +} +inline void __apex_active_harmony_setup(apex_tuning_session * tuning_session) { + APEX_UNUSED(tuning_session); +} inline void __active_harmony_throughput_setup(int num_inputs, long ** inputs, long * mins, long * maxs, long * steps) { APEX_UNUSED(num_inputs); diff --git a/src/apex/concurrency_handler.cpp b/src/apex/concurrency_handler.cpp index 852d4ac4..f9b85dea 100644 --- a/src/apex/concurrency_handler.cpp +++ b/src/apex/concurrency_handler.cpp @@ -202,6 +202,7 @@ void concurrency_handler::on_reset(task_identifier * id) { } void concurrency_handler::on_shutdown(shutdown_event_data &data) { + APEX_UNUSED(data); _terminate = true; // because there are crashes cancel(); } diff --git a/src/apex/otf2_listener.cpp b/src/apex/otf2_listener.cpp index 35058bee..d7fca192 100644 --- a/src/apex/otf2_listener.cpp +++ b/src/apex/otf2_listener.cpp @@ -38,6 +38,8 @@ using namespace std; namespace apex { + OTF2_FlushCallbacks otf2_listener::flush_callbacks; + /* Stupid Intel compiler CLAIMS to be C++14, but doesn't have support for * std::unique_ptr. */ #if __cplusplus < 201402L || defined(__INTEL_COMPILER) @@ -69,6 +71,8 @@ namespace apex { communication context. */ //cout << __func__ << " " << apex_options::otf2_collective_size() << endl; //*size = apex_options::otf2_collective_size(); + APEX_UNUSED(userData); + APEX_UNUSED(commContext); *size = my_saved_node_count; return OTF2_CALLBACK_SUCCESS; } @@ -79,6 +83,9 @@ namespace apex { context. A number between 0 and one less of the size of the communication context. */ //cout << __func__ << " " << my_saved_node_id << endl; + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(rank); *rank = my_saved_node_id; return OTF2_CALLBACK_SUCCESS; } @@ -93,6 +100,15 @@ namespace apex { fileNumber denotes in which of the partitions this OTF2_Archive should belong. localSize is the size of this partition and localRank the rank of this OTF2_Archive in the partition. */ + APEX_UNUSED(userData); + APEX_UNUSED(localCommContext); + APEX_UNUSED(globalCommContext); + APEX_UNUSED(globalRank); + APEX_UNUSED(globalSize); + APEX_UNUSED(localRank); + APEX_UNUSED(localSize); + APEX_UNUSED(fileNumber); + APEX_UNUSED(numberOfFiles); return OTF2_CALLBACK_SUCCESS; } @@ -100,12 +116,16 @@ namespace apex { OTF2_CollectiveContext *localCommContext) { /* Destroys the communication context previous created by the OTF2CreateLocalComm callback. */ + APEX_UNUSED(userData); + APEX_UNUSED(localCommContext); return OTF2_CALLBACK_SUCCESS; } OTF2_CallbackCode otf2_listener::my_OTF2Barrier (void *userData, OTF2_CollectiveContext *commContext) { /* Performs a barrier collective on the given communication context. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); return OTF2_CALLBACK_SUCCESS; } @@ -113,6 +133,12 @@ namespace apex { OTF2_CollectiveContext *commContext, void *data, uint32_t numberElements, OTF2_Type type, uint32_t root) { /* Performs a broadcast collective on the given communication context. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(data); + APEX_UNUSED(numberElements); + APEX_UNUSED(type); + APEX_UNUSED(root); return OTF2_CALLBACK_SUCCESS; } @@ -122,6 +148,13 @@ namespace apex { /* Performs a gather collective on the given communication context where each ranks contribute the same number of elements. outData is only valid at rank root. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(inData); + APEX_UNUSED(outData); + APEX_UNUSED(numberElements); + APEX_UNUSED(type); + APEX_UNUSED(root); return OTF2_CALLBACK_SUCCESS; } @@ -131,6 +164,14 @@ namespace apex { /* Performs a gather collective on the given communication context where each ranks contribute different number of elements. outData and outElements are only valid at rank root. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(inData); + APEX_UNUSED(inElements); + APEX_UNUSED(outData); + APEX_UNUSED(outElements); + APEX_UNUSED(type); + APEX_UNUSED(root); return OTF2_CALLBACK_SUCCESS; } @@ -140,6 +181,13 @@ namespace apex { /* Performs a scatter collective on the given communication context where each ranks contribute the same number of elements. inData is only valid at rank root. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(inData); + APEX_UNUSED(outData); + APEX_UNUSED(numberElements); + APEX_UNUSED(type); + APEX_UNUSED(root); return OTF2_CALLBACK_SUCCESS; } @@ -150,11 +198,22 @@ namespace apex { /* Performs a scatter collective on the given communication context where each ranks contribute different number of elements. inData and inElements are only valid at rank root. */ + APEX_UNUSED(userData); + APEX_UNUSED(commContext); + APEX_UNUSED(inData); + APEX_UNUSED(inElements); + APEX_UNUSED(outData); + APEX_UNUSED(outElements); + APEX_UNUSED(type); + APEX_UNUSED(root); return OTF2_CALLBACK_SUCCESS; } void otf2_listener::my_OTF2Release (void *userData, OTF2_CollectiveContext *globalCommContext, OTF2_CollectiveContext *localCommContext) { + APEX_UNUSED(userData); + APEX_UNUSED(globalCommContext); + APEX_UNUSED(localCommContext); /* Optionally called in OTF2_Archive_Close or OTF2_Reader_Close respectively. */ return; @@ -339,12 +398,6 @@ namespace apex { return def_writer; } - OTF2_FlushCallbacks otf2_listener::flush_callbacks = - { - .otf2_pre_flush = pre_flush, - .otf2_post_flush = post_flush - }; - /* constructor for the OTF2 listener class */ otf2_listener::otf2_listener (void) : _terminate(false), _initialized(false), comm_evt_writer(nullptr), @@ -352,10 +405,8 @@ namespace apex { /* get a start time for the trace */ globalOffset = get_time(); /* set the flusher */ - flush_callbacks = { - .otf2_pre_flush = otf2_listener::pre_flush, - .otf2_post_flush = otf2_listener::post_flush - }; + flush_callbacks.otf2_pre_flush = otf2_listener::pre_flush; + flush_callbacks.otf2_post_flush = otf2_listener::post_flush; index_filename = string(string(apex_options::otf2_archive_path()) + "/.locality."); region_filename_prefix = @@ -410,6 +461,7 @@ namespace apex { } void otf2_listener::on_startup(startup_event_data &data) { + APEX_UNUSED(data); // add the empty string to the string definitions get_string_index(empty); // save the node id, because the apex object my not be @@ -857,6 +909,7 @@ namespace apex { } void otf2_listener::on_new_node(node_event_data &data) { + APEX_UNUSED(data); return; } @@ -1152,7 +1205,7 @@ namespace apex { otf2_listener::reduce_node_properties(std::string&& str) { const int hostlength = 128; // get all hostnames - char tmp[hostlength]; + char tmp[hostlength+1]; strncpy(tmp, str.c_str(), hostlength); // make array for all hostnames @@ -1183,7 +1236,7 @@ namespace apex { char * host_index = allhostnames; // find the lowest rank with my hostname for (int i = 0 ; i < my_saved_node_count ; i++) { - char line[hostlength]; + char line[hostlength+1]; strncpy(line, host_index, hostlength); istringstream ss(line); ss >> rank >> pid >> hostname; diff --git a/src/apex/otf2_listener.hpp b/src/apex/otf2_listener.hpp index 514f6b32..3ad07fba 100644 --- a/src/apex/otf2_listener.hpp +++ b/src/apex/otf2_listener.hpp @@ -51,11 +51,23 @@ namespace apex { OTF2_FileType fileType, OTF2_LocationRef location, void* callerData, bool final ) - { return OTF2_FLUSH; } + { + APEX_UNUSED(userData); + APEX_UNUSED(fileType); + APEX_UNUSED(location); + APEX_UNUSED(callerData); + APEX_UNUSED(final); + return OTF2_FLUSH; + } static OTF2_TimeStamp post_flush( void* userData, OTF2_FileType fileType, OTF2_LocationRef location ) - { return get_time(); } + { + APEX_UNUSED(userData); + APEX_UNUSED(fileType); + APEX_UNUSED(location); + return get_time(); + } static OTF2_CallbackCode my_OTF2GetSize(void *userData, OTF2_CollectiveContext *commContext, diff --git a/src/apex/perftool_implementation.cpp b/src/apex/perftool_implementation.cpp index 61513c8f..8db2bb15 100644 --- a/src/apex/perftool_implementation.cpp +++ b/src/apex/perftool_implementation.cpp @@ -36,6 +36,7 @@ extern "C" { apex_start(APEX_NAME_STRING, const_cast(timer)); } void ps_timer_stop(const void *timer) { + APEX_UNUSED(timer); apex_stop(apex::thread_instance::instance().get_current_profiler()); } void ps_dynamic_phase_start(const char *iteration_prefix, @@ -46,6 +47,8 @@ extern "C" { } void ps_dynamic_phase_stop(const char *iteration_prefix, int iteration_number) { + APEX_UNUSED(iteration_prefix); + APEX_UNUSED(iteration_number); apex_stop(apex::thread_instance::instance().get_current_profiler()); } void* ps_create_counter(const char *counter_name) { @@ -55,6 +58,8 @@ extern "C" { apex_sample_value((const char *)(counter), value); } void ps_set_metadata(const char *name, const char *value) { + APEX_UNUSED(name); + APEX_UNUSED(value); // do nothing } diff --git a/src/apex/policy_handler.cpp b/src/apex/policy_handler.cpp index cefeda07..545a1787 100644 --- a/src/apex/policy_handler.cpp +++ b/src/apex/policy_handler.cpp @@ -448,6 +448,7 @@ namespace apex { } void policy_handler::on_shutdown(shutdown_event_data &data) { + APEX_UNUSED(data); if (_terminate) return; // prevent periodic policies from executing while we are shutting down. _terminate = true; diff --git a/src/apex/proc_read.cpp b/src/apex/proc_read.cpp index 3b473d3d..b31acfd1 100644 --- a/src/apex/proc_read.cpp +++ b/src/apex/proc_read.cpp @@ -81,9 +81,6 @@ namespace apex { // get the PAPI components int num_components = PAPI_num_components(); const PAPI_component_info_t *comp_info; - bool rapl_found = false; - bool nvml_found = false; - bool lms_found = false; int retval = PAPI_OK; // are there any components? for (int component_id = 0 ; component_id < num_components ; component_id++) { @@ -101,7 +98,6 @@ namespace apex { fprintf(stderr, "%s.\n", comp_info->disabled_reason); } } else { - rapl_found = true; rapl_EventSet = PAPI_NULL; retval = PAPI_create_eventset(&rapl_EventSet); if (retval != PAPI_OK) { @@ -166,7 +162,7 @@ namespace apex { rapl_initialized = true; } } - // do we have the RAPL (cuda) components? + // do we have the NVML (cuda) components? if (strstr(comp_info->name, "nvml")) { printf("PAPI NVML component found...\n"); if (comp_info->num_native_events == 0) { @@ -175,7 +171,6 @@ namespace apex { fprintf(stderr, "%s.\n", comp_info->disabled_reason); } } else { - nvml_found = true; nvml_EventSet = PAPI_NULL; retval = PAPI_create_eventset(&nvml_EventSet); if (retval != PAPI_OK) { @@ -246,7 +241,6 @@ namespace apex { fprintf(stderr, "%s.\n", comp_info->disabled_reason); } } else { - lms_found = true; lms_EventSet = PAPI_NULL; retval = PAPI_create_eventset(&lms_EventSet); if (retval != PAPI_OK) { @@ -287,7 +281,7 @@ namespace apex { char *max_sub = strstr(event_name, "_max"); char *crit_sub = strstr(event_name, "_crit"); char *interval_sub = strstr(event_name, "_interval"); - if (max_sub == NULL && + if (max_sub == NULL && crit_sub == NULL && interval_sub == NULL) { // save the event info //printf("Found event '%s (%s)'\n", event_name, unit); @@ -688,7 +682,7 @@ namespace apex { if (lms_initialized) { // reading might have failed, so only iterate over the data for (size_t i = 0 ; i < lms_metrics.size() ; i++) { - // PAPI scales LM sensor data by 1000, + // PAPI scales LM sensor data by 1000, // because it doesn't have floating point values.. sample_value(lms_event_names[i].c_str(), (double)lms_metrics[i]/1000.0); } @@ -1111,7 +1105,7 @@ namespace apex { std::string proc_data_reader::get_command_line(void) { std::string line; std::fstream myfile("/proc/self/cmdline", ios_base::in); - if (myfile.is_open()) { + if (myfile.is_open()) { getline (myfile,line); myfile.close(); /* From the documentation: diff --git a/src/apex/profiler_listener.cpp b/src/apex/profiler_listener.cpp index 9b5e98fc..bd3faf75 100644 --- a/src/apex/profiler_listener.cpp +++ b/src/apex/profiler_listener.cpp @@ -265,6 +265,7 @@ std::unordered_set free_profiles; unsigned int profiler_listener::process_profile( std::shared_ptr &p, unsigned int tid) { + APEX_UNUSED(tid); if(p == nullptr) return 0; profile * theprofile; if(p->is_reset == reset_type::ALL) { @@ -1433,6 +1434,7 @@ if (rc != 0) cout << "PAPI error! " << name << ": " << PAPI_strerror(rc) << endl /* On the shutdown event, notify the consumer thread that we are done * and set the "terminate" flag. */ void profiler_listener::on_shutdown(shutdown_event_data &data) { + APEX_UNUSED(data); if (_done) { return; } if (!_done) { _done = true; @@ -1539,10 +1541,11 @@ if (rc != 0) cout << "PAPI error! " << name << ": " << PAPI_strerror(rc) << endl inline void profiler_listener::push_profiler(int my_tid, std::shared_ptr &p) { - // if we aren't processing profiler objects, just return. - if (!apex_options::process_async_state()) { return; } + APEX_UNUSED(my_tid); + // if we aren't processing profiler objects, just return. + if (!apex_options::process_async_state()) { return; } #ifdef APEX_TRACE_APEX - if (p->get_task_id()->name == "apex::process_profiles") { return; } + if (p->get_task_id()->name == "apex::process_profiles") { return; } #endif // we have to make a local copy, because lockfree queues DO NOT SUPPORT // shared_ptrs! @@ -1707,7 +1710,7 @@ if (rc != 0) cout << "PAPI error! " << name << ": " << PAPI_strerror(rc) << endl } delete profiler::disabled_profiler; - }; + } } diff --git a/src/apex/profiler_listener.hpp b/src/apex/profiler_listener.hpp index cf5a8d6a..754ad2b7 100644 --- a/src/apex/profiler_listener.hpp +++ b/src/apex/profiler_listener.hpp @@ -141,7 +141,10 @@ class profiler_listener : public event_listener { int task_scatterplot_sample_file; std::stringstream task_scatterplot_samples; public: - void set_node_id(int node_id, int node_count) { this->node_id = node_id; } + void set_node_id(int node_id, int node_count) { + APEX_UNUSED(node_count); + this->node_id = node_id; + } profiler_listener (void) : _initialized(false), _done(false), node_id(0), task_map() #if APEX_HAVE_PAPI diff --git a/src/apex/pthread_wrapper.hpp b/src/apex/pthread_wrapper.hpp index c4d53573..550fad44 100644 --- a/src/apex/pthread_wrapper.hpp +++ b/src/apex/pthread_wrapper.hpp @@ -148,7 +148,7 @@ class pthread_wrapper { } }; // class -}; // namespace +} // namespace #endif diff --git a/src/apex/task_identifier.cpp b/src/apex/task_identifier.cpp index b1108bc4..fbecc3d1 100644 --- a/src/apex/task_identifier.cpp +++ b/src/apex/task_identifier.cpp @@ -24,9 +24,10 @@ namespace apex { // only let one thread at a time resolve the name of this task -std::mutex bfd_mutex;; +std::mutex bfd_mutex; - task_identifier::apex_name_map::apex_name_map() : tid(thread_instance::get_id()) {}; + task_identifier::apex_name_map::apex_name_map() : + tid(thread_instance::get_id()) {} task_identifier::apex_name_map::~apex_name_map(void) { if (tid == 0) { finalize(); @@ -38,7 +39,8 @@ std::mutex bfd_mutex;; the program exits and the pointers aren't needed any more. */ } - task_identifier::apex_addr_map::apex_addr_map() : tid(thread_instance::get_id()) {}; + task_identifier::apex_addr_map::apex_addr_map() : + tid(thread_instance::get_id()) {} task_identifier::apex_addr_map::~apex_addr_map(void) { if (tid == 0) { finalize(); diff --git a/src/apex/tau_listener.cpp b/src/apex/tau_listener.cpp index d392b666..b6eded36 100644 --- a/src/apex/tau_listener.cpp +++ b/src/apex/tau_listener.cpp @@ -201,6 +201,7 @@ bool tau_listener::initialize_tau(int argc, char** argv) { } void tau_listener::on_startup(startup_event_data &data) { + APEX_UNUSED(data); return; } @@ -268,6 +269,7 @@ bool tau_listener::initialize_tau(int argc, char** argv) { } inline void tau_listener::_common_stop(std::shared_ptr &p) { + APEX_UNUSED(p); static string empty(""); if (!_terminate) { //if (p->tt_ptr->get_task_id()->get_name().compare(empty) == 0) { @@ -315,6 +317,7 @@ bool tau_listener::initialize_tau(int argc, char** argv) { } void tau_listener::set_node_id(int node_id, int node_count) { + APEX_UNUSED(node_count); my_Tau_set_node(node_id); } @@ -339,6 +342,7 @@ bool tau_listener::initialize_tau(int argc, char** argv) { } void tau_listener::Tau_stop_wrapper(const char * name) { + APEX_UNUSED(name); if (tau_listener::initialized()) { my_Tau_global_stop(); // stop the top level timer } diff --git a/src/apex/utils.cpp b/src/apex/utils.cpp index 77f916f3..cd7c98c7 100644 --- a/src/apex/utils.cpp +++ b/src/apex/utils.cpp @@ -425,5 +425,5 @@ uint32_t simple_reverse(uint32_t x) return x; } -}; +} // namespace apex diff --git a/src/examples/CountCalls/count_calls.cpp b/src/examples/CountCalls/count_calls.cpp index 50c8cb54..06dac678 100644 --- a/src/examples/CountCalls/count_calls.cpp +++ b/src/examples/CountCalls/count_calls.cpp @@ -57,8 +57,9 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); apex::init(argv[0], 0, 1); - apex::scoped_timer proxy((apex_function_address)main); + apex::scoped_timer proxy(__func__); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; @@ -76,9 +77,9 @@ int main(int argc, char **argv) apex_profile * profile = apex::get_profile((apex_function_address)(do_work)); if (profile) { std::cout << "Value Reported : " << profile->calls << std::endl; - if ((func_count - yield_count) == profile->calls) { + if ((func_count - yield_count) == profile->calls) { std::cout << "Test passed." << std::endl; - } else if ((func_count - yield_count) > profile->calls) { + } else if ((func_count - yield_count) > profile->calls) { // OK to under-report. std::cout << "Test passed." << std::endl; } diff --git a/src/examples/CustomTuning/custom_tuning.cpp b/src/examples/CustomTuning/custom_tuning.cpp index ec2c2bf4..0c1b2795 100644 --- a/src/examples/CustomTuning/custom_tuning.cpp +++ b/src/examples/CustomTuning/custom_tuning.cpp @@ -19,10 +19,12 @@ double sv = 0.0; * The Main function */ int main (int argc, char ** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("Custom Tuning Test", 0, 1); #ifdef APEX_HAVE_ACTIVEHARMONY - int num_inputs = 2; + int num_inputs = 2; long * inputs[2] = {0L,0L}; long mins[2] = {0,0}; // all minimums are 1 long maxs[2] = {10,10}; // we'll set these later @@ -30,7 +32,7 @@ int main (int argc, char ** argv) { inputs[0] = ¶m_1; inputs[1] = ¶m_2; my_custom_event = apex::register_custom_event("Adjust Eqn1 Params"); - std::function func = []()->double{ return value; }; + std::function func = []()->double{ return value; }; apex_tuning_session_handle session = apex::setup_custom_tuning(func, my_custom_event, num_inputs, inputs, mins, maxs, steps); std::cout << "Running custom tuning test" << std::endl; @@ -42,7 +44,7 @@ int main (int argc, char ** argv) { long steps_2[1] = {1}; inputs_2[0] = &x; my_custom_event_2 = apex::register_custom_event("Adjust Eqn2 Params"); - std::function func_2 = []()->double{ return sv; }; + std::function func_2 = []()->double{ return sv; }; apex_tuning_session_handle session_2 = apex::setup_custom_tuning(func_2, my_custom_event_2, num_inputs_2, inputs_2, mins_2, maxs_2, steps_2); diff --git a/src/examples/DemoCpp/demo.cpp b/src/examples/DemoCpp/demo.cpp index 94f01b16..09e15860 100644 --- a/src/examples/DemoCpp/demo.cpp +++ b/src/examples/DemoCpp/demo.cpp @@ -90,6 +90,7 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); /* Initialize APEX */ apex::init(argv[0], 0, 1); /* Get some version and verbose option information */ diff --git a/src/examples/LuleshMPIOpenMP/synchronous_policy.cpp b/src/examples/LuleshMPIOpenMP/synchronous_policy.cpp index eb02bd93..d263e0a9 100644 --- a/src/examples/LuleshMPIOpenMP/synchronous_policy.cpp +++ b/src/examples/LuleshMPIOpenMP/synchronous_policy.cpp @@ -5,7 +5,7 @@ #include #if defined (_OPENMP) #include "omp.h" -#else +#else #define omp_get_max_threads() 1 #endif #include "apex_api.hpp" @@ -24,6 +24,7 @@ void apex_example_set_function_address(apex_function_address addr) { } int apex_example_policy_func(apex_context const context) { + APEX_UNUSED(context); // get value apex_profile * p = NULL; p = apex_get_profile(APEX_FUNCTION_ADDRESS, (void*)function_address); @@ -32,7 +33,7 @@ int apex_example_policy_func(apex_context const context) { current_value = p->accumulated; } // wait for the application to warm up - static int countdown = 10; + static int countdown = 10; if (countdown > 0) { countdown = countdown - 1; return APEX_NOERROR; @@ -51,7 +52,7 @@ int apex_example_policy_func(apex_context const context) { // should we change our cap? - are we off by more than 1/2 of a thread? //double one_worker = (1.0/apex::apex_options::throttling_max_threads())*0.55; double one_worker = (1.0/__active_threads)*0.51; - if (((mytimer/outvalues[1]) > ((__active_threads/outvalues[0]) + one_worker)) + if (((mytimer/outvalues[1]) > ((__active_threads/outvalues[0]) + one_worker)) && (__active_threads < apex::apex_options::throttling_max_threads())) { std::cout << __myrank << ": " << one_worker << " timer: " << (mytimer/outvalues[1]) << " thread: " << (__active_threads/outvalues[0]) << std::endl; diff --git a/src/examples/MPIAutoBalance/mpi_auto_balance.cpp b/src/examples/MPIAutoBalance/mpi_auto_balance.cpp index 98a06004..b7620714 100644 --- a/src/examples/MPIAutoBalance/mpi_auto_balance.cpp +++ b/src/examples/MPIAutoBalance/mpi_auto_balance.cpp @@ -5,7 +5,7 @@ #include #if defined (_OPENMP) #include "omp.h" -#else +#else #define omp_get_max_threads() 1 #endif #include "apex_api.hpp" @@ -93,14 +93,14 @@ void dump_array(std::vector * my_array) { */ inline void solve_cell(std::vector & in_array, std::vector & out_array, long index) { if (__builtin_expect(index == 0,0)) { - out_array[index] = (in_array[index] + + out_array[index] = (in_array[index] + in_array[index+1]) / 2.0; } else if (__builtin_expect(index == num_cells - 1,0)) { - out_array[index] = (in_array[index-1] + + out_array[index] = (in_array[index-1] + in_array[index]) / 2.0; } else { - out_array[index] = (in_array[index-1] + - in_array[index] + + out_array[index] = (in_array[index-1] + + in_array[index] + in_array[index+1]) / 3.0; } } @@ -181,13 +181,13 @@ int main (int argc, char ** argv) { MPI_Comm_size(MPI_COMM_WORLD, &num_ranks); apex::init("MPI TEST", myrank, num_ranks); apex_example_set_rank_info(myrank, num_ranks); - + #ifdef APEX_HAVE_ACTIVEHARMONY - long * inputs[1] = {0L}; + //long * inputs[1] = {0L}; long mins[3] = {1}; // all minimums are 1 long maxs[3] = {0}; // we'll set these later long steps[3] = {1}; // all step sizes are 1 - inputs[0] = &active_threads; + //inputs[0] = &active_threads; mins[0] = apex::apex_options::throttling_min_threads(); // allow user configuration maxs[0] = apex::apex_options::throttling_max_threads(); // allow user configuration std::cout <<"Tuning Parameters:" << std::endl; diff --git a/src/examples/MPIAutoBalance/synchronous_policy.cpp b/src/examples/MPIAutoBalance/synchronous_policy.cpp index d887b705..c1751221 100644 --- a/src/examples/MPIAutoBalance/synchronous_policy.cpp +++ b/src/examples/MPIAutoBalance/synchronous_policy.cpp @@ -5,7 +5,7 @@ #include #if defined (_OPENMP) #include "omp.h" -#else +#else #define omp_get_max_threads() 1 #endif #include "apex_api.hpp" @@ -24,6 +24,7 @@ void apex_example_set_function_address(apex_function_address addr) { } int apex_example_policy_func(apex_context const context) { + APEX_UNUSED(context); // get value apex_profile * p = NULL; p = apex_get_profile(APEX_FUNCTION_ADDRESS, (void*)function_address); @@ -32,7 +33,7 @@ int apex_example_policy_func(apex_context const context) { current_value = p->accumulated; } // wait for the application to warm up - static int countdown = 10; + static int countdown = 10; if (countdown > 0) { countdown = countdown - 1; //printf("Waiting...\n"); @@ -52,7 +53,7 @@ int apex_example_policy_func(apex_context const context) { // should we change our cap? - are we off by more than 1/2 of a thread? double one_worker = (1.0/apex::apex_options::throttling_max_threads())*0.55; /* - std::cout << __myrank << ": " << one_worker + std::cout << __myrank << ": " << one_worker << " timer: " << (mytimer/outvalues[1]) << " thread: " << (__active_threads/outvalues[0]) << std::endl; diff --git a/src/examples/Matmult/matmult.cpp b/src/examples/Matmult/matmult.cpp index 210806fa..d99dbf10 100644 --- a/src/examples/Matmult/matmult.cpp +++ b/src/examples/Matmult/matmult.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * OpenMp Example - Matrix Multiply - C Version -* Demonstrates a matrix multiply using OpenMP. +* Demonstrates a matrix multiply using OpenMP. * * Modified from here: * https://computing.llnl.gov/tutorials/openMP/samples/C/omp_mm.c * -* For PAPI_FP_INS, the exclusive count for the event: +* For PAPI_FP_INS, the exclusive count for the event: * for (null) [OpenMP location: file:matmult.c ] -* should be 2E+06 / Number of Threads +* should be 2E+06 / Number of Threads ******************************************************************************/ #include #include @@ -72,9 +72,9 @@ void compute_nested(double **a, double **b, double **c, int rows_a, int cols_a, for (k=0; k #include - + #include #include "apex_api.hpp" @@ -101,7 +101,7 @@ void handle_start(const std::string & name) { if(profile == nullptr) { std::cerr << "ERROR: no profile for " << name << std::endl; return 0.0; - } + } if(profile->calls == 0.0) { std::cerr << "ERROR: calls = 0 for " << name << std::endl; return 0.0; @@ -157,7 +157,7 @@ void handle_stop(const std::string & name) { apex::reset(name); } } -}; +} int policy(const apex_context context) { //std::cout << __func__ << std::endl; @@ -179,7 +179,7 @@ int policy(const apex_context context) { if(name.find("OpenMP_PARALLEL_REGION") == 0) { handle_stop(name); } - } + } return APEX_NOERROR; } @@ -233,7 +233,7 @@ void read_results(const std::string & filename) { std::shared_ptr threads_param = request->add_param_enum("omp_num_threads", threads, {threads}); std::shared_ptr schedule_param = request->add_param_enum("omp_schedule", schedule, {schedule}); std::shared_ptr chunk_param = request->add_param_enum("omp_chunk_size", chunk_size, {chunk_size}); - + if(apex_openmp_policy_verbose) { fprintf(stderr, "Added %s -> (%s, %s, %s) from history.\n", name.c_str(), threads.c_str(), schedule.c_str(), chunk_size.c_str()); } @@ -347,7 +347,7 @@ bool parse_space_file(const std::string & filename) { } } thread_space = new std::list{num_threads_list}; - + // omp_schedule std::list schedule_list; for(auto itr = omp_schedule_array.Begin(); itr != omp_schedule_array.End(); ++itr) { @@ -379,7 +379,7 @@ bool parse_space_file(const std::string & filename) { } } chunk_space = new std::list{chunk_size_list}; - + } return true; } @@ -420,7 +420,7 @@ void print_tuning_space() { int register_policy() { // Process environment variables - + // APEX_OPENMP_VERBOSE const char * apex_openmp_policy_verbose_option = std::getenv("APEX_OPENMP_VERBOSE"); if(apex_openmp_policy_verbose_option != nullptr) { @@ -430,7 +430,7 @@ int register_policy() { // APEX_OPENMP_WINDOW const char * option = std::getenv("APEX_OPENMP_WINDOW"); if(option != nullptr) { - apex_openmp_policy_tuning_window = atoi(option); + apex_openmp_policy_tuning_window = atoi(option); } if(apex_openmp_policy_verbose) { std::cerr << "apex_openmp_policy_tuning_window = " << apex_openmp_policy_tuning_window << std::endl; @@ -439,8 +439,8 @@ int register_policy() { // APEX_OPENMP_STRATEGY const char * apex_openmp_policy_tuning_strategy_option = std::getenv("APEX_OPENMP_STRATEGY"); std::string apex_openmp_policy_tuning_strategy_str = (apex_openmp_policy_tuning_strategy_option == nullptr) ? std::string() : std::string(apex_openmp_policy_tuning_strategy_option); - transform(apex_openmp_policy_tuning_strategy_str.begin(), - apex_openmp_policy_tuning_strategy_str.end(), + transform(apex_openmp_policy_tuning_strategy_str.begin(), + apex_openmp_policy_tuning_strategy_str.end(), apex_openmp_policy_tuning_strategy_str.begin(), ::toupper); if(apex_openmp_policy_tuning_strategy_str.empty()) { // default @@ -486,7 +486,7 @@ int register_policy() { if(!using_space_file) { std::cerr << "WARNING: Unable to use tuning space file " << apex_openmp_policy_space_file_option << ". Using default tuning space instead." << std::endl; } - } + } // Set up the search spaces if(!using_space_file) { @@ -515,22 +515,22 @@ int register_policy() { // Register the policy functions with APEX std::function policy_fn{policy}; - start_policy = apex::register_policy(APEX_START_EVENT, policy_fn); - stop_policy = apex::register_policy(APEX_STOP_EVENT, policy_fn); + start_policy = apex::register_policy(APEX_START_EVENT, policy_fn); + stop_policy = apex::register_policy(APEX_STOP_EVENT, policy_fn); if(start_policy == nullptr || stop_policy == nullptr) { return APEX_ERROR; } else { return APEX_NOERROR; } } - + extern "C" { int apex_plugin_init() { std::cout << __func__ << std::endl; if(!apex_openmp_policy_running) { fprintf(stderr, "apex_openmp_policy init\n"); - apex_openmp_policy_tuning_requests = new std::unordered_map>(); + apex_openmp_policy_tuning_requests = new std::unordered_map>(); int status = register_policy(); apex_openmp_policy_running = true; return status; diff --git a/src/examples/Overhead/testOverhead.cpp b/src/examples/Overhead/testOverhead.cpp index 1d80025e..010d882e 100644 --- a/src/examples/Overhead/testOverhead.cpp +++ b/src/examples/Overhead/testOverhead.cpp @@ -152,7 +152,7 @@ int main(int argc, char **argv) } sleep(1); // if we don't sleep, the proc_read thread won't have time to read anything. - apex::profiler * m = apex::start((apex_function_address)main); + apex::profiler * m = apex::start(__func__); 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)); @@ -214,11 +214,11 @@ int main(int argc, char **argv) std::cout << "Estimated overhead per timer: "; #ifdef APEX_USE_CLOCK_TIMESTAMP std::cout << overhead_per_call*1.0e9; - std::cout << METRIC << " (" << percent_increase*100.0 << + std::cout << METRIC << " (" << percent_increase*100.0 << "%), per call time in foo: " << (foo_per_call*1.0e9) << METRIC << std::endl; #else std::cout << overhead_per_call; - std::cout << METRIC << " (" << percent_increase*100.0 << + std::cout << METRIC << " (" << percent_increase*100.0 << "%), per call time in foo: " << foo_per_call << METRIC << std::endl; #endif } diff --git a/src/examples/PolicyEngineCppExample/testPolicyEngine.cpp b/src/examples/PolicyEngineCppExample/testPolicyEngine.cpp index 167f2e80..e33f26ba 100644 --- a/src/examples/PolicyEngineCppExample/testPolicyEngine.cpp +++ b/src/examples/PolicyEngineCppExample/testPolicyEngine.cpp @@ -42,11 +42,12 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); apex::init(argv[0], 0, 1); apex::apex_options::use_policy(true); apex::apex_options::use_screen_output(true); apex::apex_options::use_profile_output(true); - apex::profiler * profiler = apex::start((apex_function_address)main); + apex::profiler * profiler = apex::start(__func__); const apex_event_type when = APEX_STOP_EVENT; apex::register_periodic_policy(1000000, [](apex_context const& context){ UNUSED(context); diff --git a/src/examples/TestGetPower/getpower.cpp b/src/examples/TestGetPower/getpower.cpp index 75d0adcb..505784a6 100644 --- a/src/examples/TestGetPower/getpower.cpp +++ b/src/examples/TestGetPower/getpower.cpp @@ -26,8 +26,9 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); apex::init(argv[0], 0, 1); - apex::scoped_timer proxy((apex_function_address)main); + apex::scoped_timer proxy(__func__); 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/TestITT/testITT.cpp b/src/examples/TestITT/testITT.cpp index 8cf6a2db..3f39c5c5 100644 --- a/src/examples/TestITT/testITT.cpp +++ b/src/examples/TestITT/testITT.cpp @@ -5,13 +5,15 @@ #include "stdio.h" int main (int argc, char** argv) { - apex::init("ITT Test", 0, 1); + APEX_UNUSED(argc); + APEX_UNUSED(argv); + apex::init("ITT Test", 0, 1); __itt_domain* domain = __itt_domain_create("Example.Domain.Global"); __itt_string_handle* handle_main = __itt_string_handle_create("ittTest.main"); __itt_task_begin(domain, __itt_null, __itt_null, handle_main); printf("ITT demo.\n"); __itt_task_end(domain); - apex::finalize(); + apex::finalize(); return 0; } diff --git a/src/examples/TestReset/reset.cpp b/src/examples/TestReset/reset.cpp index eea02e73..efbb91ad 100644 --- a/src/examples/TestReset/reset.cpp +++ b/src/examples/TestReset/reset.cpp @@ -6,6 +6,7 @@ using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); init(argv[0], 0, 1); cout << "APEX Version : " << version() << endl; profiler * main_profiler = start((apex_function_address)(main)); @@ -13,12 +14,12 @@ int main (int argc, char** argv) { for(int i = 0; i < 30; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 40 times for(int i = 0; i < 40; ++i) { profiler * p = start("bar"); stop(p); - } + } // Reset everything reset(APEX_NULL_FUNCTION_ADDRESS); usleep(100); @@ -26,20 +27,20 @@ int main (int argc, char** argv) { for(int i = 0; i < 3; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 4 times for(int i = 0; i < 4; ++i) { profiler * p = start("bar"); stop(p); - } + } // The profile should show "foo" was called 3 times // and bar was called 4 times. - + // Call "Test Timer" 100 times for(int i = 0; i < 100; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // Reset "Test Timer" reset("Test Timer"); usleep(100); @@ -47,7 +48,7 @@ int main (int argc, char** argv) { for(int i = 0; i < 25; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // The profile should show "Test Timer" was called 25 times. stop(main_profiler); finalize(); diff --git a/src/examples/TestThreads/testThreads.cpp b/src/examples/TestThreads/testThreads.cpp index 2be614fd..d469062e 100644 --- a/src/examples/TestThreads/testThreads.cpp +++ b/src/examples/TestThreads/testThreads.cpp @@ -26,8 +26,9 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); apex::init(argv[0], 0, 1); - apex::scoped_timer proxy((apex_function_address)main); + apex::scoped_timer proxy(__func__); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/examples/ThrottlingCpp/testThrottling.cpp b/src/examples/ThrottlingCpp/testThrottling.cpp index 5c0a39a4..3ec09452 100644 --- a/src/examples/ThrottlingCpp/testThrottling.cpp +++ b/src/examples/ThrottlingCpp/testThrottling.cpp @@ -74,6 +74,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); init(argv[0], 0, 1); //print_options(); apex_options::throttle_concurrency(true); @@ -83,7 +84,7 @@ int main(int argc, char **argv) APEX_DISCRETE_HILL_CLIMBING, 100000); int original_cap = get_thread_cap(); - profiler* p = start((apex_function_address)main); + profiler* p = start(__func__); printf("PID of this process: %d\n", getpid()); pthread_t* thread = new pthread_t[NUM_THREADS]; int* ids = new int[NUM_THREADS]; diff --git a/src/examples/TuningRequest/tuning_request.cpp b/src/examples/TuningRequest/tuning_request.cpp index 7fee9330..149bca5c 100644 --- a/src/examples/TuningRequest/tuning_request.cpp +++ b/src/examples/TuningRequest/tuning_request.cpp @@ -14,28 +14,30 @@ apex_event_type my_custom_event = APEX_CUSTOM_EVENT_1; * The Main function */ int main (int argc, char ** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("Custom Tuning Test", 0, 1); #ifdef APEX_HAVE_ACTIVEHARMONY apex_tuning_request request("tuning_request_example"); - + // Trigger my_custom_event = apex::register_custom_event("Get New Params"); request.set_trigger(my_custom_event); std::shared_ptr param_long = request.add_param_long("long", 5, 0, 20, 1); - + std::shared_ptr param_double = request.add_param_double("double", 5.0, 0.0, 20.0, 1.0); - + std::list enum_vals{"a", "b", "c", "d", "e"}; std::shared_ptr param_enum = request.add_param_enum("enum", "c", enum_vals); double value = 0.0; - + std::function func = [&]()->double{ return value; }; diff --git a/src/unit_tests/C++/apex_cleanup.cpp b/src/unit_tests/C++/apex_cleanup.cpp index 3e7d694e..7cfecdc0 100644 --- a/src/unit_tests/C++/apex_cleanup.cpp +++ b/src/unit_tests/C++/apex_cleanup.cpp @@ -1,6 +1,8 @@ #include "apex_api.hpp" int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex::cleanup unit test", 0, 1); apex::apex_options::use_screen_output(true); apex::finalize(); diff --git a/src/unit_tests/C++/apex_current_power_high.cpp b/src/unit_tests/C++/apex_current_power_high.cpp index a671fb8e..2d396104 100644 --- a/src/unit_tests/C++/apex_current_power_high.cpp +++ b/src/unit_tests/C++/apex_current_power_high.cpp @@ -26,8 +26,10 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init(NULL, 0, 1); - apex::scoped_timer proxy((apex_function_address)main); + apex::scoped_timer proxy(__func__); 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_custom_event.cpp b/src/unit_tests/C++/apex_custom_event.cpp index 2055da39..9d3cc3ab 100644 --- a/src/unit_tests/C++/apex_custom_event.cpp +++ b/src/unit_tests/C++/apex_custom_event.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -126,12 +127,15 @@ int policy_event(apex_context const context) { } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex_policy_handle * on_startup = apex::register_policy(APEX_STARTUP, startup_policy); apex::register_policy(APEX_SHUTDOWN, policy_event); apex_policy_handle * on_new_node = apex::register_policy(APEX_NEW_NODE, policy_event); @@ -149,7 +153,7 @@ int main(int argc, char **argv) apex_policy_handle * on_custom_event_1 = apex::register_policy(custom_type_1, policy_event); apex_policy_handle * on_custom_event_2 = apex::register_policy(custom_type_2, policy_event); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { @@ -158,7 +162,7 @@ int main(int argc, char **argv) for (i = 0 ; i < NUM_THREADS ; i++) { pthread_join(thread[i], NULL); } - // now un-register the policies + // now un-register the policies if (on_startup != nullptr) { printf("Deregistering %d...\n", on_startup->id); apex::deregister_policy(on_startup); diff --git a/src/unit_tests/C++/apex_deregister_policy.cpp b/src/unit_tests/C++/apex_deregister_policy.cpp index 5e48cf81..6b96ad74 100644 --- a/src/unit_tests/C++/apex_deregister_policy.cpp +++ b/src/unit_tests/C++/apex_deregister_policy.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -126,12 +127,15 @@ int policy_event(apex_context const context) { } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init(NULL, 0, 1); apex_policy_handle * on_startup = apex::register_policy(APEX_STARTUP, startup_policy); apex::register_policy(APEX_SHUTDOWN, policy_event); @@ -146,7 +150,7 @@ int main(int argc, char **argv) custom_type_2 = apex::register_custom_event("CUSTOM 2"); apex_policy_handle * on_custom_event_1 = apex::register_policy(custom_type_1, policy_event); apex_policy_handle * on_custom_event_2 = apex::register_policy(custom_type_2, policy_event); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { @@ -155,7 +159,7 @@ int main(int argc, char **argv) for (i = 0 ; i < NUM_THREADS ; i++) { pthread_join(thread[i], NULL); } - // now un-register the policies + // now un-register the policies if (on_startup != nullptr) { printf("Deregistering %d...\n", on_startup->id); apex::deregister_policy(on_startup); diff --git a/src/unit_tests/C++/apex_dump.cpp b/src/unit_tests/C++/apex_dump.cpp index cf3861ec..bb447333 100644 --- a/src/unit_tests/C++/apex_dump.cpp +++ b/src/unit_tests/C++/apex_dump.cpp @@ -6,20 +6,22 @@ using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::dump unit test", 0, 1); apex_options::use_screen_output(true); cout << "APEX Version : " << version() << endl; - profiler * main_profiler = start((apex_function_address)(main)); + profiler * main_profiler = start(__func__); // Call "foo" 30 times for(int i = 0; i < 30; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 40 times for(int i = 0; i < 40; ++i) { profiler * p = start("bar"); stop(p); - } + } // dump and reset everything cout << "\n\n *** Should see 30 calls to foo, and 40 calls to bar...\n\n" << endl; @@ -30,20 +32,20 @@ int main (int argc, char** argv) { for(int i = 0; i < 3; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 4 times for(int i = 0; i < 4; ++i) { profiler * p = start("bar"); stop(p); - } + } // The profile should show "foo" was called 3 times // and bar was called 4 times. - + // Call "Test Timer" 100 times for(int i = 0; i < 100; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // dump and reset nothing cout << "\n\n *** Should see 3 calls to foo, and 4 calls to bar, and 100 calls to Test Timer...\n\n" << endl; dump(false); @@ -54,7 +56,7 @@ int main (int argc, char** argv) { for(int i = 0; i < 25; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // The profile should show "Test Timer" was called 25 times. stop(main_profiler); cout << "\n\n *** Should see 0 calls to foo, and 4 calls to bar, and 100+ calls to Test Timer...\n\n" << endl; diff --git a/src/unit_tests/C++/apex_exit_thread.cpp b/src/unit_tests/C++/apex_exit_thread.cpp index 43fe732b..d727adb0 100644 --- a/src/unit_tests/C++/apex_exit_thread.cpp +++ b/src/unit_tests/C++/apex_exit_thread.cpp @@ -23,6 +23,8 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::exit_thread unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); diff --git a/src/unit_tests/C++/apex_finalize.cpp b/src/unit_tests/C++/apex_finalize.cpp index 3965a2e5..fc50b663 100644 --- a/src/unit_tests/C++/apex_finalize.cpp +++ b/src/unit_tests/C++/apex_finalize.cpp @@ -1,6 +1,8 @@ #include "apex_api.hpp" int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex::finalize unit test", 0, 1); apex::apex_options::use_screen_output(true); apex::finalize(); diff --git a/src/unit_tests/C++/apex_get_profile.cpp b/src/unit_tests/C++/apex_get_profile.cpp index bb8c2073..bc3f5706 100644 --- a/src/unit_tests/C++/apex_get_profile.cpp +++ b/src/unit_tests/C++/apex_get_profile.cpp @@ -6,19 +6,21 @@ using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::get_profile unit test", 0, 1); cout << "APEX Version : " << version() << endl; - profiler * main_profiler = start((apex_function_address)(main)); + profiler * main_profiler = start(__func__); // Call "foo" 30 times for(int i = 0; i < 30; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 40 times for(int i = 0; i < 40; ++i) { profiler * p = start("bar"); stop(p); - } + } // Reset everything reset(APEX_NULL_FUNCTION_ADDRESS); usleep(100); @@ -26,20 +28,20 @@ int main (int argc, char** argv) { for(int i = 0; i < 3; ++i) { profiler * p = start("foo"); stop(p); - } + } // Call "bar" 4 times for(int i = 0; i < 4; ++i) { profiler * p = start("bar"); stop(p); - } + } // The profile should show "foo" was called 3 times // and bar was called 4 times. - + // Call "Test Timer" 100 times for(int i = 0; i < 100; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // Reset "Test Timer" reset("Test Timer"); usleep(100); @@ -47,7 +49,7 @@ int main (int argc, char** argv) { for(int i = 0; i < 25; ++i) { profiler * p = start("Test Timer"); stop(p); - } + } // The profile should show "Test Timer" was called 25 times. stop(main_profiler); finalize(); diff --git a/src/unit_tests/C++/apex_get_thread_cap.cpp b/src/unit_tests/C++/apex_get_thread_cap.cpp index 68b725ff..ad1ded92 100644 --- a/src/unit_tests/C++/apex_get_thread_cap.cpp +++ b/src/unit_tests/C++/apex_get_thread_cap.cpp @@ -69,6 +69,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); init(argv[0], 0, 1); //print_options(); @@ -76,7 +77,7 @@ int main(int argc, char **argv) APEX_DISCRETE_HILL_CLIMBING, 1000000); int original_cap = get_thread_cap(); - profiler* p = start((apex_function_address)main); + profiler* p = start(__func__); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/unit_tests/C++/apex_hpx_annotated_functions.cpp b/src/unit_tests/C++/apex_hpx_annotated_functions.cpp index e2eec27b..38f355e1 100644 --- a/src/unit_tests/C++/apex_hpx_annotated_functions.cpp +++ b/src/unit_tests/C++/apex_hpx_annotated_functions.cpp @@ -26,21 +26,22 @@ pthread_barrier_t barrier; int nsleep(long miliseconds, int tid) { + APEX_UNUSED(tid); struct timespec req, rem; // add some variation double randval = 1.0 + (((double)(rand())) / RAND_MAX); miliseconds = (int)(miliseconds * randval); if(miliseconds > 999) - { + { req.tv_sec = (int)(miliseconds / 1000); /* Must be Non-Negative */ req.tv_nsec = (miliseconds - ((long)req.tv_sec * 1000)) * 1000000; /* Must be in range of 0 to 999999999 */ - } + } else - { + { req.tv_sec = 0; /* Must be Non-Negative */ req.tv_nsec = miliseconds * 1000000; /* Must be in range of 0 to 999999999 */ - } + } #ifdef __DEBUG_PRINT__ std::stringstream buf; @@ -107,7 +108,7 @@ int main (int argc, char** argv) { apex::init("apex::start unit test", 0, 1); #endif /* important, to make sure we get correct profiles at the end */ - apex::apex_options::use_screen_output(true); + apex::apex_options::use_screen_output(true); /* start a timer */ apex::profiler* p = apex::start("main"); /* Spawn X threads */ @@ -119,7 +120,7 @@ int main (int argc, char** argv) { #ifndef __APPLE__ pthread_barrier_init(&barrier, NULL, test_numthreads); #endif - if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { + if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { test_numthreads = std::min(test_numthreads, apex::hardware_concurrency()); } int * tids = (int*)calloc(test_numthreads, sizeof(int)); diff --git a/src/unit_tests/C++/apex_hpx_direct_actions.cpp b/src/unit_tests/C++/apex_hpx_direct_actions.cpp index 68b0b982..d7d95405 100644 --- a/src/unit_tests/C++/apex_hpx_direct_actions.cpp +++ b/src/unit_tests/C++/apex_hpx_direct_actions.cpp @@ -5,6 +5,7 @@ #include #include #include "apex_api.hpp" +#include "apex_assert.h" uint32_t test_numthreads = 0; int threads_per_core = 8; @@ -26,19 +27,21 @@ int nsleep(long miliseconds, int tid) miliseconds = (int)(miliseconds * randval); if(miliseconds > 999) - { + { req.tv_sec = (int)(miliseconds / 1000); /* Must be Non-Negative */ req.tv_nsec = (miliseconds - ((long)req.tv_sec * 1000)) * 1000000; /* Must be in range of 0 to 999999999 */ - } + } else - { + { req.tv_sec = 0; /* Must be Non-Negative */ req.tv_nsec = miliseconds * 1000000; /* Must be in range of 0 to 999999999 */ - } + } #ifdef __DEBUG_PRINT__ std::stringstream buf; buf << "APP: " << tid << ": Computing " << miliseconds << " miliseconds\n"; std::cout << buf.str(); +#else + APEX_UNUSED(tid); #endif return nanosleep(&req , &rem); } @@ -48,11 +51,18 @@ void innerLoop(int *tid) { #ifdef __DEBUG_PRINT__ std::stringstream buf; buf << "APP: " << *tid << ": Starting thread " << tt_ptr->guid << "\n"; std::cout << buf.str(); +#else + APEX_UNUSED(tid); #endif apex::start(tt_ptr); /* do some computation */ int ret = nsleep(10, *tid); // after - t: 10, af: 0 +#ifdef NDEBUG + APEX_UNUSED(ret); +#else + APEX_ASSERT(ret == 0); +#endif /* Start a timer like an "direct_action" */ std::shared_ptr af = apex::new_task("direct_action", UINTMAX_MAX, tt_ptr); @@ -131,7 +141,7 @@ int main (int argc, char** argv) { /* initialize APEX */ apex::init("apex::start unit test", 0, 1); /* important, to make sure we get correct profiles at the end */ - apex::apex_options::use_screen_output(true); + apex::apex_options::use_screen_output(true); /* start a timer */ apex::profiler* p = apex::start("main"); /* Spawn X threads */ @@ -143,7 +153,7 @@ int main (int argc, char** argv) { #ifndef __APPLE__ pthread_barrier_init(&barrier, NULL, test_numthreads); #endif - if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { + if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { test_numthreads = std::min(test_numthreads, apex::hardware_concurrency()); } int * tids = (int*)calloc(test_numthreads, sizeof(int)); diff --git a/src/unit_tests/C++/apex_hpx_task_wrapper_direct_actions.cpp b/src/unit_tests/C++/apex_hpx_task_wrapper_direct_actions.cpp index 4b5f1526..adbdccbc 100644 --- a/src/unit_tests/C++/apex_hpx_task_wrapper_direct_actions.cpp +++ b/src/unit_tests/C++/apex_hpx_task_wrapper_direct_actions.cpp @@ -5,6 +5,7 @@ #include #include #include "apex_api.hpp" +#include "apex_assert.h" uint32_t test_numthreads = 0; int threads_per_core = 8; @@ -21,21 +22,22 @@ pthread_barrier_t barrier; int nsleep(long miliseconds, int tid) { + APEX_UNUSED(tid); struct timespec req, rem; // add some variation double randval = 1.0 + (((double)(rand())) / RAND_MAX); miliseconds = (int)(miliseconds * randval); if(miliseconds > 999) - { + { req.tv_sec = (int)(miliseconds / 1000); /* Must be Non-Negative */ req.tv_nsec = (miliseconds - ((long)req.tv_sec * 1000)) * 1000000; /* Must be in range of 0 to 999999999 */ - } + } else - { + { req.tv_sec = 0; /* Must be Non-Negative */ req.tv_nsec = miliseconds * 1000000; /* Must be in range of 0 to 999999999 */ - } + } #ifdef __DEBUG_PRINT__ std::stringstream buf; @@ -59,6 +61,11 @@ void innerLoop(int *tid) { /* do some computation */ int ret = nsleep(10, *tid); // after - t: 10, af: 0 +#ifdef NDEBUG + APEX_UNUSED(ret); +#else + APEX_ASSERT(ret == 0); +#endif /* Start a timer like an "direct_action" */ std::shared_ptr af = apex::new_task("direct_action"); @@ -139,7 +146,7 @@ int main (int argc, char** argv) { /* initialize APEX */ apex::init("apex::start unit test", 0, 1); /* important, to make sure we get correct profiles at the end */ - apex::apex_options::use_screen_output(true); + apex::apex_options::use_screen_output(true); /* start a timer */ apex::profiler* p = apex::start("main"); /* Spawn X threads */ @@ -152,7 +159,7 @@ int main (int argc, char** argv) { #ifndef __APPLE__ pthread_barrier_init(&barrier, NULL, test_numthreads); #endif - if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { + if (apex::apex_options::use_tau() || apex::apex_options::use_otf2()) { test_numthreads = std::min(test_numthreads, apex::hardware_concurrency()); } int * tids = (int*)calloc(test_numthreads, sizeof(int)); diff --git a/src/unit_tests/C++/apex_init.cpp b/src/unit_tests/C++/apex_init.cpp index bd71e1b6..a94d4ada 100644 --- a/src/unit_tests/C++/apex_init.cpp +++ b/src/unit_tests/C++/apex_init.cpp @@ -1,6 +1,8 @@ #include "apex_api.hpp" int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex::init unit test", 0, 1); apex::apex_options::use_screen_output(true); apex::finalize(); diff --git a/src/unit_tests/C++/apex_init_args.cpp b/src/unit_tests/C++/apex_init_args.cpp index bd71e1b6..a94d4ada 100644 --- a/src/unit_tests/C++/apex_init_args.cpp +++ b/src/unit_tests/C++/apex_init_args.cpp @@ -1,6 +1,8 @@ #include "apex_api.hpp" int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex::init unit test", 0, 1); apex::apex_options::use_screen_output(true); apex::finalize(); diff --git a/src/unit_tests/C++/apex_new_task.cpp b/src/unit_tests/C++/apex_new_task.cpp index 3704dd62..595fdcf7 100644 --- a/src/unit_tests/C++/apex_new_task.cpp +++ b/src/unit_tests/C++/apex_new_task.cpp @@ -36,7 +36,7 @@ int fib (int in) { int main(int argc, char *argv[]) { apex::init("apex_new_task_cpp unit test", 0, 1); - apex::scoped_timer foo((uint64_t)&main); + apex::scoped_timer foo(__func__); #if defined(APEX_HAVE_TAU) || (APEX_HAVE_OTF2) int i = 5; #else diff --git a/src/unit_tests/C++/apex_non_worker_thread.cpp b/src/unit_tests/C++/apex_non_worker_thread.cpp index acab3595..2077f91b 100644 --- a/src/unit_tests/C++/apex_non_worker_thread.cpp +++ b/src/unit_tests/C++/apex_non_worker_thread.cpp @@ -49,8 +49,10 @@ uint64_t bar(uint64_t i) { } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex_start unit test", 0, 1); - apex::profiler* p = apex::start((apex_function_address)&main); + apex::profiler* p = apex::start(__func__); uint64_t i = 0; std::thread threads[MAX_THREADS]; for (i = 0 ; i < MAX_THREADS ; i++) { diff --git a/src/unit_tests/C++/apex_print_options.cpp b/src/unit_tests/C++/apex_print_options.cpp index 3f51e059..7676127d 100644 --- a/src/unit_tests/C++/apex_print_options.cpp +++ b/src/unit_tests/C++/apex_print_options.cpp @@ -7,6 +7,8 @@ using namespace apex; using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex_options::use_screen_output(true); init("apex::print_options unit test", 0, 1); cout << "APEX Version : " << version() << endl; diff --git a/src/unit_tests/C++/apex_profiler_guids.cpp b/src/unit_tests/C++/apex_profiler_guids.cpp index 4128d41d..36be701e 100644 --- a/src/unit_tests/C++/apex_profiler_guids.cpp +++ b/src/unit_tests/C++/apex_profiler_guids.cpp @@ -59,6 +59,8 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); /* initialize APEX */ apex::init("apex::start unit test", 0, 1); /* start a timer */ diff --git a/src/unit_tests/C++/apex_pthread_flood.cpp b/src/unit_tests/C++/apex_pthread_flood.cpp index ca6afd89..3ffce35f 100644 --- a/src/unit_tests/C++/apex_pthread_flood.cpp +++ b/src/unit_tests/C++/apex_pthread_flood.cpp @@ -62,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::scoped_timer proxy((apex_function_address)main); + apex::scoped_timer proxy(__func__); printf("PID of this process: %d\n", getpid()); std::cout << "Expecting " << test_numthreads << " threads." << std::endl; pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * test_numthreads)); diff --git a/src/unit_tests/C++/apex_register_custom_event.cpp b/src/unit_tests/C++/apex_register_custom_event.cpp index 2055da39..9d3cc3ab 100644 --- a/src/unit_tests/C++/apex_register_custom_event.cpp +++ b/src/unit_tests/C++/apex_register_custom_event.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -126,12 +127,15 @@ int policy_event(apex_context const context) { } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex_policy_handle * on_startup = apex::register_policy(APEX_STARTUP, startup_policy); apex::register_policy(APEX_SHUTDOWN, policy_event); apex_policy_handle * on_new_node = apex::register_policy(APEX_NEW_NODE, policy_event); @@ -149,7 +153,7 @@ int main(int argc, char **argv) apex_policy_handle * on_custom_event_1 = apex::register_policy(custom_type_1, policy_event); apex_policy_handle * on_custom_event_2 = apex::register_policy(custom_type_2, policy_event); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { @@ -158,7 +162,7 @@ int main(int argc, char **argv) for (i = 0 ; i < NUM_THREADS ; i++) { pthread_join(thread[i], NULL); } - // now un-register the policies + // now un-register the policies if (on_startup != nullptr) { printf("Deregistering %d...\n", on_startup->id); apex::deregister_policy(on_startup); diff --git a/src/unit_tests/C++/apex_register_periodic_policy.cpp b/src/unit_tests/C++/apex_register_periodic_policy.cpp index 3123f821..a80f8741 100644 --- a/src/unit_tests/C++/apex_register_periodic_policy.cpp +++ b/src/unit_tests/C++/apex_register_periodic_policy.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -55,23 +56,27 @@ void* someThread(void* tmp) } int policy_periodic(apex_context const context) { + APEX_UNUSED(context); apex_profile * p = apex::get_profile((apex_function_address)&foo); if (p != NULL) { - printf("Periodic Policy: %p %d %f seconds.\n", foo, (int)p->calls, p->accumulated/p->calls); + printf("Periodic Policy: %p %d %f seconds.\n", (void*)foo, (int)p->calls, p->accumulated/p->calls); } return APEX_NOERROR; } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex_register_periodic_policy unit test", 0, 1); apex_policy_handle * on_periodic = apex::register_periodic_policy(1000000, policy_periodic); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { diff --git a/src/unit_tests/C++/apex_register_policy.cpp b/src/unit_tests/C++/apex_register_policy.cpp index 7fbbb5eb..c566394e 100644 --- a/src/unit_tests/C++/apex_register_policy.cpp +++ b/src/unit_tests/C++/apex_register_policy.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -140,12 +141,15 @@ int policy_event(apex_context const context) { } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex_policy_handle * on_startup = apex::register_policy(APEX_STARTUP, startup_policy); apex::register_policy(APEX_SHUTDOWN, policy_event); apex_policy_handle * on_new_node = apex::register_policy(APEX_NEW_NODE, policy_event); @@ -165,7 +169,7 @@ int main(int argc, char **argv) apex_policy_handle * on_custom_event_1 = apex::register_policy(custom_type_1, policy_event); apex_policy_handle * on_custom_event_2 = apex::register_policy(custom_type_2, policy_event); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { @@ -174,7 +178,7 @@ int main(int argc, char **argv) for (i = 0 ; i < NUM_THREADS ; i++) { pthread_join(thread[i], NULL); } - // now un-register the policies + // now un-register the policies if (on_startup != nullptr) { printf("Deregistering %d...\n", on_startup->id); apex::deregister_policy(on_startup); diff --git a/src/unit_tests/C++/apex_register_policy_set.cpp b/src/unit_tests/C++/apex_register_policy_set.cpp index 1d7ced63..26df7be7 100644 --- a/src/unit_tests/C++/apex_register_policy_set.cpp +++ b/src/unit_tests/C++/apex_register_policy_set.cpp @@ -37,6 +37,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::sample_value("some value", 42); apex::profiler* my_profiler = apex::start((apex_function_address)&someThread); @@ -50,15 +51,18 @@ void* someThread(void* tmp) } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); std::set when = {APEX_STARTUP, APEX_SHUTDOWN, APEX_NEW_NODE, APEX_NEW_THREAD, APEX_START_EVENT, APEX_STOP_EVENT, APEX_SAMPLE_VALUE}; - std::set handles = + std::set handles = apex::register_policy(when, [](apex_context const& context)->int{ switch(context.event_type) { case APEX_STARTUP: std::cout << "Startup event\n"; fflush(stdout); break; @@ -77,7 +81,7 @@ int main(int argc, char **argv) apex::init("apex_register_policy_set unit test", 0, 1); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { diff --git a/src/unit_tests/C++/apex_register_thread.cpp b/src/unit_tests/C++/apex_register_thread.cpp index 27051193..69fc5179 100644 --- a/src/unit_tests/C++/apex_register_thread.cpp +++ b/src/unit_tests/C++/apex_register_thread.cpp @@ -23,6 +23,8 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::register_thread unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); diff --git a/src/unit_tests/C++/apex_reset.cpp b/src/unit_tests/C++/apex_reset.cpp index fb5d729b..2cc75056 100644 --- a/src/unit_tests/C++/apex_reset.cpp +++ b/src/unit_tests/C++/apex_reset.cpp @@ -6,21 +6,23 @@ using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::reset unit test", 0, 1); cout << "APEX Version : " << version() << endl; - profiler * main_profiler = start((apex_function_address)(main)); + profiler * main_profiler = start(__func__); // Call "foo" 30 times for(int i = 0; i < 30; ++i) { profiler * p = start("foo"); usleep(1000); stop(p); - } + } // Call "bar" 40 times for(int i = 0; i < 40; ++i) { profiler * p = start("bar"); usleep(1000); stop(p); - } + } // Reset everything reset(APEX_NULL_FUNCTION_ADDRESS); usleep(1000); @@ -29,22 +31,22 @@ int main (int argc, char** argv) { profiler * p = start("foo"); usleep(1000); stop(p); - } + } // Call "bar" 4 times for(int i = 0; i < 4; ++i) { profiler * p = start("bar"); usleep(1000); stop(p); - } + } // The profile should show "foo" was called 3 times // and bar was called 4 times. - + // Call "Test Timer" 100 times for(int i = 0; i < 100; ++i) { profiler * p = start("Test Timer"); usleep(1000); stop(p); - } + } // Reset "Test Timer" reset("Test Timer"); usleep(1000); @@ -53,7 +55,7 @@ int main (int argc, char** argv) { profiler * p = start("Test Timer"); usleep(1000); stop(p); - } + } // The profile should show "Test Timer" was called 25 times. stop(main_profiler); finalize(); diff --git a/src/unit_tests/C++/apex_resume.cpp b/src/unit_tests/C++/apex_resume.cpp index 86d30f5d..02363ae3 100644 --- a/src/unit_tests/C++/apex_resume.cpp +++ b/src/unit_tests/C++/apex_resume.cpp @@ -25,10 +25,12 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::start unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); - profiler* p = start((apex_function_address)(main)); + profiler* p = start(__func__); pthread_t thread[2]; int tid = 0; pthread_create(&(thread[0]), NULL, someThread, &tid); diff --git a/src/unit_tests/C++/apex_sample_value.cpp b/src/unit_tests/C++/apex_sample_value.cpp index ce68e1fd..7eb55eed 100644 --- a/src/unit_tests/C++/apex_sample_value.cpp +++ b/src/unit_tests/C++/apex_sample_value.cpp @@ -23,6 +23,8 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::sample_value unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); diff --git a/src/unit_tests/C++/apex_set_state.cpp b/src/unit_tests/C++/apex_set_state.cpp index 11a3b4c5..b9bc4479 100644 --- a/src/unit_tests/C++/apex_set_state.cpp +++ b/src/unit_tests/C++/apex_set_state.cpp @@ -3,6 +3,8 @@ using namespace apex; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex_set_state unit test", 0, 1); apex_options::use_screen_output(true); set_state(APEX_IDLE); diff --git a/src/unit_tests/C++/apex_setup_timer_throttling.cpp b/src/unit_tests/C++/apex_setup_timer_throttling.cpp index 20ec90b1..6d422e47 100644 --- a/src/unit_tests/C++/apex_setup_timer_throttling.cpp +++ b/src/unit_tests/C++/apex_setup_timer_throttling.cpp @@ -69,6 +69,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); init(argv[0], 0, 1); apex_options::throttle_concurrency(1); //print_options(); @@ -77,7 +78,7 @@ int main(int argc, char **argv) APEX_DISCRETE_HILL_CLIMBING, 1000000); int original_cap = get_thread_cap(); - profiler* p = start((apex_function_address)main); + profiler* p = start(__func__); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/unit_tests/C++/apex_shutdown_throttling.cpp b/src/unit_tests/C++/apex_shutdown_throttling.cpp index 4bab5cf7..da9f3d9b 100644 --- a/src/unit_tests/C++/apex_shutdown_throttling.cpp +++ b/src/unit_tests/C++/apex_shutdown_throttling.cpp @@ -69,6 +69,7 @@ void* someThread(void* tmp) int main(int argc, char **argv) { + APEX_UNUSED(argc); init(argv[0], 0, 1); //print_options(); @@ -76,7 +77,7 @@ int main(int argc, char **argv) APEX_DISCRETE_HILL_CLIMBING, 1000000); int original_cap = get_thread_cap(); - profiler* p = start((apex_function_address)main); + profiler* p = start(__func__); printf("PID of this process: %d\n", getpid()); pthread_t thread[NUM_THREADS]; int i; diff --git a/src/unit_tests/C++/apex_start.cpp b/src/unit_tests/C++/apex_start.cpp index d13cba40..01de4a6c 100644 --- a/src/unit_tests/C++/apex_start.cpp +++ b/src/unit_tests/C++/apex_start.cpp @@ -23,6 +23,8 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); /* initialize APEX */ apex::init("apex::start unit test", 0, 1); /* start a timer */ diff --git a/src/unit_tests/C++/apex_stop.cpp b/src/unit_tests/C++/apex_stop.cpp index cbcdbe11..81bdfe97 100644 --- a/src/unit_tests/C++/apex_stop.cpp +++ b/src/unit_tests/C++/apex_stop.cpp @@ -23,10 +23,12 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::stop unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); - profiler* p = start((apex_function_address)(main)); + profiler* p = start(__func__); pthread_t thread[2]; int tid = 0; pthread_create(&(thread[0]), NULL, someThread, &tid); diff --git a/src/unit_tests/C++/apex_stop_all_async_threads.cpp b/src/unit_tests/C++/apex_stop_all_async_threads.cpp index 7d0046e6..da56ef68 100644 --- a/src/unit_tests/C++/apex_stop_all_async_threads.cpp +++ b/src/unit_tests/C++/apex_stop_all_async_threads.cpp @@ -40,6 +40,7 @@ int foo (int i) { void* someThread(void* tmp) { + APEX_UNUSED(tmp); apex::register_thread("threadTest thread"); apex::custom_event(custom_type_1, NULL); apex::sample_value("some value", 42); @@ -55,24 +56,28 @@ void* someThread(void* tmp) } int policy_periodic(apex_context const context) { + APEX_UNUSED(context); apex_profile * p = apex::get_profile((apex_function_address)&foo); if (p != NULL) { - printf("Periodic Policy: %p %d %f seconds.\n", foo, (int)p->calls, p->accumulated/p->calls); + printf("Periodic Policy: %p %d %f seconds.\n", (void*)foo, (int)p->calls, p->accumulated/p->calls); } return APEX_NOERROR; } int startup_policy(apex_context const context) { + APEX_UNUSED(context); printf("Startup Policy...\n"); return APEX_NOERROR; } int main(int argc, char **argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex_register_periodic_policy unit test", 0, 1); apex::apex_options::use_screen_output(true); apex_policy_handle * on_periodic = apex::register_periodic_policy(100000, policy_periodic); - apex::profiler* my_profiler = apex::start((apex_function_address)&main); + apex::profiler* my_profiler = apex::start(__func__); pthread_t thread[NUM_THREADS]; int i; for (i = 0 ; i < NUM_THREADS ; i++) { diff --git a/src/unit_tests/C++/apex_task_wrapper.cpp b/src/unit_tests/C++/apex_task_wrapper.cpp index 507ab480..781a846c 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, std::shared_ptr tt) { int main(int argc, char *argv[]) { apex::init("apex_new_task_cpp unit test", 0, 1); - apex::scoped_timer foo((uint64_t)&main); + apex::scoped_timer foo(__func__); #if defined(APEX_HAVE_TAU) || (APEX_HAVE_OTF2) int i = 5; #else diff --git a/src/unit_tests/C++/apex_task_wrapper2.cpp b/src/unit_tests/C++/apex_task_wrapper2.cpp index a149dac5..13735ec4 100644 --- a/src/unit_tests/C++/apex_task_wrapper2.cpp +++ b/src/unit_tests/C++/apex_task_wrapper2.cpp @@ -38,7 +38,7 @@ int fib (int in, std::shared_ptr tt) { int main(int argc, char *argv[]) { apex::init("apex_new_task_cpp unit test", 0, 1); - apex::scoped_timer foo((uint64_t)&main); + apex::scoped_timer foo(__func__); #if defined(APEX_HAVE_TAU) || (APEX_HAVE_OTF2) int i = 5; #else diff --git a/src/unit_tests/C++/apex_throttle_event.cpp b/src/unit_tests/C++/apex_throttle_event.cpp index 6a7a2ed1..fcf118bc 100644 --- a/src/unit_tests/C++/apex_throttle_event.cpp +++ b/src/unit_tests/C++/apex_throttle_event.cpp @@ -31,7 +31,7 @@ uint64_t foo(uint64_t i) { int main (int argc, char** argv) { apex::init("apex_start unit test", 0, 1); - apex::profiler* p = apex::start((apex_function_address)&main); + apex::profiler* p = apex::start(__func__); uint64_t i = 0; std::thread threads[MAX_THREADS]; for (i = 0 ; i < MAX_THREADS ; i++) { diff --git a/src/unit_tests/C++/apex_version.cpp b/src/unit_tests/C++/apex_version.cpp index 774c84f9..0ba1bcba 100644 --- a/src/unit_tests/C++/apex_version.cpp +++ b/src/unit_tests/C++/apex_version.cpp @@ -2,6 +2,8 @@ #include int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); apex::init("apex::version unit test", 0, 1); std::cout << apex::version() << std::endl; apex::finalize(); diff --git a/src/unit_tests/C++/apex_yield.cpp b/src/unit_tests/C++/apex_yield.cpp index f5f42361..635ecb5f 100644 --- a/src/unit_tests/C++/apex_yield.cpp +++ b/src/unit_tests/C++/apex_yield.cpp @@ -25,10 +25,12 @@ void* someThread(void* tmp) } int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex::start unit test", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::print_options(); - profiler* p = start((apex_function_address)(main)); + profiler* p = start(__func__); pthread_t thread[2]; int tid = 0; pthread_create(&(thread[0]), NULL, someThread, &tid); diff --git a/src/utils/apex_make_default_config.cpp b/src/utils/apex_make_default_config.cpp index 1935f9da..515fc990 100644 --- a/src/utils/apex_make_default_config.cpp +++ b/src/utils/apex_make_default_config.cpp @@ -7,6 +7,8 @@ using namespace apex; using namespace std; int main (int argc, char** argv) { + APEX_UNUSED(argc); + APEX_UNUSED(argv); init("apex_make_default_config", 0, 1); cout << "APEX Version : " << version() << endl; apex_options::make_default_config();