├── .circleci └── config.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── LICENSE.txt ├── README.intel_mic ├── README.md ├── bootstrap-configs ├── README.edison ├── bootstrap-aciss.sh ├── bootstrap-arya.sh ├── bootstrap-cori.sh ├── bootstrap-edison-mpi.sh ├── bootstrap-edison-openmp.sh ├── bootstrap-edison.sh ├── bootstrap-everything-x86_64-linux.sh ├── bootstrap-intel-linux.sh ├── bootstrap-macbook.sh ├── bootstrap-macpro.sh ├── bootstrap-main.sh ├── bootstrap-mic-linux.sh ├── bootstrap-power8-linux.sh ├── bootstrap-x86_64-linux.sh └── dependencies │ ├── build-papi.sh │ └── build-tau.sh ├── cmake ├── Modules │ ├── APEX_Compile.cmake │ ├── APEX_CompilerFlags.cmake │ ├── APEX_DefaultOptions.cmake │ ├── APEX_Distclean.cmake │ ├── APEX_GCCVersion.cmake │ ├── APEX_GetIncludeDirectory.cmake │ ├── APEX_Include.cmake │ ├── APEX_ListContains.cmake │ ├── APEX_Message.cmake │ ├── APEX_Option.cmake │ ├── APEX_ParseArguments.cmake │ ├── APEX_SetupActiveHarmony.cmake │ ├── APEX_SetupBFD.cmake │ ├── APEX_SetupCUPTI.cmake │ ├── APEX_SetupDemangle.cmake │ ├── APEX_SetupHIP.cmake │ ├── APEX_SetupHPXMP.cmake │ ├── APEX_SetupKokkos.cmake │ ├── APEX_SetupLMSensors.cmake │ ├── APEX_SetupMPI.cmake │ ├── APEX_SetupMSR.cmake │ ├── APEX_SetupOTF2.cmake │ ├── APEX_SetupPAPI.cmake │ ├── APEX_SetupPlugins.cmake │ ├── APEX_SetupZlib.cmake │ ├── APEX_Utils.cmake │ ├── ActiveHarmony.patch │ ├── AddGitSubmodule.cmake │ ├── BuildOMPT.cmake │ ├── ExternalProjectBoost.cmake │ ├── FindACTIVEHARMONY.cmake │ ├── FindBFD.cmake │ ├── FindCUDAToolkit.cmake │ ├── FindCUPTI.cmake │ ├── FindDEMANGLE.cmake │ ├── FindHWLOC.cmake │ ├── FindJEmalloc.cmake │ ├── FindKokkos.cmake │ ├── FindLEVEL0.cmake │ ├── FindLM_SENSORS.cmake │ ├── FindMSR.cmake │ ├── FindNVML.cmake │ ├── FindOMPT.cmake │ ├── FindOTF2.cmake │ ├── FindOpenACCProfiling.cmake │ ├── FindPAPI.cmake │ ├── FindPHIPROF.cmake │ ├── FindRCR.cmake │ ├── FindROCPROFILER.cmake │ ├── FindROCTRACER.cmake │ ├── FindROCTRACER_KFD.cmake │ ├── FindROCTX.cmake │ ├── FindRSMI.cmake │ ├── FindSTARPU.cmake │ ├── FindTcmalloc.cmake │ ├── GitExternal.cmake │ ├── LibFindMacros.cmake │ ├── ProcessorCount.cmake │ ├── intel_mic_toolchain.cmake │ └── otf2_collective_callbacks.patch └── tests │ ├── gcc_version.cpp │ ├── ompt_5.0_test │ ├── CMakeLists.txt │ └── ompt_test.cpp │ ├── ompt_5.1_test │ ├── CMakeLists.txt │ └── ompt_test.cpp │ └── openacc_test │ ├── CMakeLists.txt │ ├── openacc_test.cpp │ └── openacc_test.hpp ├── doc ├── CMakeLists.txt ├── Doxyfile.in ├── README ├── apex.dox ├── apex.old.dox ├── logo-cropped.pdf ├── logo-cropped.png ├── logo.pdf ├── logo.pptx └── webdocs │ ├── README.md │ ├── docs │ ├── custom.css │ ├── environment.md │ ├── examples.md │ ├── feature.md │ ├── hpx5.md │ ├── img │ │ ├── APEX_arch.pdf │ │ ├── APEX_arch.png │ │ ├── APEX_diagram.pdf │ │ ├── APEX_diagram.png │ │ ├── cuda_taskgraph.png │ │ ├── fibonacci_scatterplot.png │ │ ├── jumpshot1.tiff │ │ ├── jumpshot2.tiff │ │ ├── logo-cropped.pdf │ │ ├── logo-cropped.png │ │ ├── lulesh-paraprof1.tiff │ │ ├── lulesh-paraprof2.tiff │ │ ├── lulesh-paraprof3.tiff │ │ ├── openacc_taskgraph.png │ │ ├── openmp_taskgraph.png │ │ ├── paraprof1.tiff │ │ ├── paraprof2.tiff │ │ ├── pi_cu_gte.png │ │ └── pi_cu_trace.png │ ├── index.md │ ├── install.md │ ├── quickstart.md │ ├── quickstarthpx.md │ ├── refman.md │ ├── spec.md │ ├── usage.md │ └── usecases.md │ └── mkdocs.yml ├── etc ├── buildbot.sh ├── buildbot_hpx.sh ├── configuration-files │ ├── apex-ah-ompt-papi-mpi-otf.conf │ ├── apex-ah-ompt-papi-mpi-tau.conf │ ├── apex-ah-ompt-papi-mpi.conf │ ├── apex-ah-ompt-papi.conf │ ├── apex-ah-ompt.conf │ ├── apex-ah.conf │ ├── apex-base.conf │ ├── apex-defaults.conf │ ├── i386-kevinmacbookair.local-gcc.sh │ ├── ppc64le-minotaur-gcc.sh │ ├── x86_64-delphi-gcc.sh │ ├── x86_64-godzilla-gcc.sh │ ├── x86_64-grover-gcc.sh │ ├── x86_64-grover-icc.sh │ └── x86_64-ktau-gcc.sh ├── job.pbs ├── make-archive.sh ├── maketag.sh ├── pr_upstream.sh ├── regression-test.sh ├── runme.sh └── spack │ └── package.py ├── pkgconfig └── apex.pc.in ├── src ├── ITTNotify │ ├── CMakeLists.lsu │ ├── CMakeLists.standalone │ ├── CMakeLists.txt │ ├── ittnotify.cpp │ ├── ittnotify.h │ ├── ittnotify_export.h │ └── legacy │ │ └── ittnotify.h ├── apex │ ├── APEXConfig.cmake │ ├── CMakeLists.txt │ ├── CMakeLists_hpx.cmake │ ├── CMakeLists_standalone.cmake │ ├── Config.cmake.in │ ├── ITTNotify │ ├── L0 │ │ ├── demangle.h │ │ ├── pti_assert.h │ │ ├── utils.h │ │ ├── ze_api_callbacks.h │ │ ├── ze_api_collector.h │ │ ├── ze_kernel_collector.h │ │ └── ze_utils.h │ ├── address_resolution.cpp │ ├── address_resolution.hpp │ ├── apex.cpp │ ├── apex.h │ ├── apex.hpp │ ├── apex_api.hpp │ ├── apex_assert.h │ ├── apex_bfd.cpp │ ├── apex_bfd.h │ ├── apex_clock.hpp │ ├── apex_config.h.in │ ├── apex_cxx_shared_lock.hpp │ ├── apex_dynamic.cpp │ ├── apex_dynamic.hpp │ ├── apex_error_handling.cpp │ ├── apex_error_handling.hpp │ ├── apex_export.h │ ├── apex_kokkos.cpp │ ├── apex_kokkos.hpp │ ├── apex_kokkos_tuning.cpp │ ├── apex_level0.cpp │ ├── apex_mpi.cpp │ ├── apex_mpif.F90 │ ├── apex_nvml.cpp │ ├── apex_nvml.hpp │ ├── apex_ompt.cpp │ ├── apex_openacc.cpp │ ├── apex_openacc.hpp │ ├── apex_opencl.cpp │ ├── apex_opencl.hpp │ ├── apex_options.cpp │ ├── apex_options.hpp │ ├── apex_phiprof.cpp │ ├── apex_policies.cpp │ ├── apex_policies.h │ ├── apex_policies.hpp │ ├── apex_preload.cpp │ ├── apex_raja.cpp │ ├── apex_raja.hpp │ ├── apex_rocm_smi.cpp │ ├── apex_rocm_smi.hpp │ ├── apex_starpu.cpp │ ├── apex_types.h │ ├── apex_version.h.in │ ├── async_thread_node.hpp │ ├── banner.hpp │ ├── concurrency_handler.cpp │ ├── concurrency_handler.hpp │ ├── csv_parser.cpp │ ├── csv_parser.h │ ├── ctrl │ │ ├── run_kernel.h │ │ ├── test_aql.h │ │ ├── test_hsa.cpp │ │ ├── test_hsa.h │ │ └── test_kernel.h │ ├── cupti_trace.cpp │ ├── dependency_tree.cpp │ ├── dependency_tree.hpp │ ├── event_filter.cpp │ ├── event_filter.hpp │ ├── event_listener.cpp │ ├── event_listener.hpp │ ├── exhaustive.cpp │ ├── exhaustive.hpp │ ├── genetic_search.cpp │ ├── genetic_search.hpp │ ├── global_constructor_destructor.h │ ├── gzstream.cpp │ ├── gzstream.hpp │ ├── handler.cpp │ ├── handler.hpp │ ├── hip_profiler.cpp │ ├── hip_profiler.hpp │ ├── hip_trace.cpp │ ├── memory_wrapper.cpp │ ├── memory_wrapper.hpp │ ├── nelder_mead.cpp │ ├── nelder_mead.hpp │ ├── nelder_mead_internal.h │ ├── nvtx_listener.cpp │ ├── nvtx_listener.hpp │ ├── otf2_listener.cpp │ ├── otf2_listener.hpp │ ├── otf2_listener_hpx.cpp │ ├── otf2_listener_mpi.cpp │ ├── otf2_listener_nompi.cpp │ ├── perfetto_listener.cpp │ ├── perfetto_listener.hpp │ ├── perfetto_static.cpp │ ├── perfetto_static.hpp │ ├── perftool_implementation.cpp │ ├── policy_handler.cpp │ ├── policy_handler.hpp │ ├── proc_read.cpp │ ├── proc_read.h │ ├── proc_read_papi.cpp │ ├── profile.hpp │ ├── profile_reducer.cpp │ ├── profile_reducer.hpp │ ├── profiler.hpp │ ├── profiler_listener.cpp │ ├── profiler_listener.hpp │ ├── pthread_wrapper.hpp │ ├── random.cpp │ ├── random.hpp │ ├── semaphore.hpp │ ├── sensor_data.cpp │ ├── sensor_data.hpp │ ├── simulated_annealing.cpp │ ├── simulated_annealing.hpp │ ├── task_dependency.hpp │ ├── task_identifier.cpp │ ├── task_identifier.hpp │ ├── task_wrapper.hpp │ ├── taskstubs_implementation.cpp │ ├── tau_dummy.cpp │ ├── tau_listener.cpp │ ├── tau_listener.hpp │ ├── tcmalloc_hooks.cpp │ ├── tcmalloc_hooks.hpp │ ├── thread_instance.cpp │ ├── thread_instance.hpp │ ├── threadpool.cpp │ ├── threadpool.h │ ├── tool │ │ ├── gfx_metrics.xml │ │ ├── metrics.xml │ │ ├── pmc_input.xml │ │ ├── pmc_input1.xml │ │ └── tool.cpp │ ├── trace_event_listener.cpp │ ├── trace_event_listener.hpp │ ├── tree.cpp │ ├── tree.h │ ├── util │ │ ├── helper_funcs.h │ │ ├── hsa_rsrc_factory.cpp │ │ ├── hsa_rsrc_factory.h │ │ ├── perf_timer.cpp │ │ ├── perf_timer.h │ │ ├── test_assert.h │ │ └── xml.h │ ├── utils.cpp │ └── utils.hpp ├── comm │ ├── CMakeLists.txt │ ├── apex_global.h │ └── mpi │ │ ├── CMakeLists.txt │ │ └── apex_global_mpi.c ├── examples │ ├── CMakeLists.txt │ ├── CountCalls │ │ ├── CMakeLists.txt │ │ └── count_calls.cpp │ ├── CustomTuning │ │ ├── CMakeLists.txt │ │ └── custom_tuning.cpp │ ├── DemoC │ │ ├── CMakeLists.txt │ │ └── demo.c │ ├── DemoCpp │ │ ├── CMakeLists.txt │ │ └── demo.cpp │ ├── EventFilter │ │ ├── CMakeLists.txt │ │ ├── event_filter.json │ │ └── eventfilter_example.cpp │ ├── LuleshMPI │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── lulesh-comm.cc │ │ ├── lulesh-init.cc │ │ ├── lulesh-util.cc │ │ ├── lulesh-viz.cc │ │ ├── lulesh.cc │ │ ├── lulesh.h │ │ └── lulesh_tuple.h │ ├── LuleshMPIOpenMP │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── lulesh-comm.cc │ │ ├── lulesh-init.cc │ │ ├── lulesh-util.cc │ │ ├── lulesh-viz.cc │ │ ├── lulesh.cc │ │ ├── lulesh.h │ │ ├── lulesh_tuple.h │ │ ├── synchronous_policy.cpp │ │ └── synchronous_policy.hpp │ ├── LuleshOpenMP │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── lulesh-comm.cc │ │ ├── lulesh-init.cc │ │ ├── lulesh-util.cc │ │ ├── lulesh-viz.cc │ │ ├── lulesh.cc │ │ ├── lulesh.h │ │ └── lulesh_tuple.h │ ├── MPIAutoBalance │ │ ├── CMakeLists.txt │ │ ├── mpi_auto_balance.cpp │ │ ├── synchronous_policy.cpp │ │ └── synchronous_policy.hpp │ ├── MPIGlobalTest │ │ ├── CMakeLists.txt │ │ └── mpi_test.cpp │ ├── MPIImbalancePolicy │ │ ├── CMakeLists.txt │ │ └── mpi_test.cpp │ ├── MPITest │ │ ├── CMakeLists.txt │ │ └── mpi_test.cpp │ ├── Matmult │ │ ├── CMakeLists.txt │ │ ├── matmult.cpp │ │ ├── matmult_initialize.cpp │ │ └── matmult_initialize.h │ ├── OpenMPOverhead │ │ ├── CMakeLists.txt │ │ └── openmp_overhead.c │ ├── OpenMP_1D_stencil │ │ ├── 1d_stencil.cpp │ │ └── CMakeLists.txt │ ├── OpenMP_Policy │ │ ├── CMakeLists.txt │ │ ├── apex_openmp_policy.cpp │ │ ├── policy_test.cpp │ │ └── space.json │ ├── Overhead │ │ ├── CMakeLists.txt │ │ └── testOverhead.cpp │ ├── PeriodicPlugin │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── apex_periodic_policy.cpp │ │ └── policy_test.cpp │ ├── PolicyEngineCppExample │ │ ├── CMakeLists.txt │ │ └── testPolicyEngine.cpp │ ├── PolicyEngineExample │ │ ├── CMakeLists.txt │ │ └── testPolicyEngine.c │ ├── PolicyUnitTest │ │ ├── CMakeLists.txt │ │ └── policyUnitTest.c │ ├── PthreadWrapper │ │ ├── CMakeLists.txt │ │ └── apex_pthread_wrap.c │ ├── TestGetPower │ │ ├── CMakeLists.txt │ │ └── getpower.cpp │ ├── TestITT │ │ ├── CMakeLists.txt │ │ └── testITT.cpp │ ├── TestOpenMP │ │ ├── CMakeLists.txt │ │ └── openmp_test.c │ ├── TestReset │ │ ├── CMakeLists.txt │ │ └── reset.cpp │ ├── TestThreads │ │ ├── CMakeLists.txt │ │ └── testThreads.cpp │ ├── Throttling │ │ ├── CMakeLists.txt │ │ └── testThrottling.c │ ├── ThrottlingActiveHarmony │ │ ├── CMakeLists.txt │ │ └── testThrottlingActiveHarmony.c │ ├── ThrottlingCpp │ │ ├── CMakeLists.txt │ │ └── testThrottling.cpp │ └── TuningRequest │ │ ├── CMakeLists.txt │ │ └── tuning_request.cpp ├── openmp │ ├── CMakeLists.txt │ ├── ompt_master.c │ ├── ompt_parallel_region.c │ ├── ompt_reduction.c │ ├── ompt_sections.c │ ├── ompt_single.c │ ├── ompt_sync_region_wait.c │ ├── ompt_target.c │ ├── ompt_target_daxpy.c │ ├── ompt_target_daxpy.cpp │ ├── ompt_target_matmult.c │ ├── ompt_target_matmult.cpp │ ├── ompt_target_vector_add.c │ ├── ompt_task.c │ └── ompt_thread.c ├── perfetto_sdk │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── perfetto.cc │ └── perfetto.h ├── scripts │ ├── CMakeLists.txt │ ├── apex-summary.py │ ├── apex-treesummary.py │ ├── apex_exec │ ├── apex_pthread_exec │ ├── consolidate.py │ ├── counter_scatterplot.py │ ├── fix_binutils_path.sh │ ├── gtrace_filter.py │ ├── gtrace_merger.py │ ├── make_release.txt │ ├── roofline_stats.py │ └── task_scatterplot.py ├── unit_tests │ ├── C++ │ │ ├── CMakeLists.txt │ │ ├── apex_cleanup.cpp │ │ ├── apex_current_power_high.cpp │ │ ├── apex_custom_event.cpp │ │ ├── apex_deregister_policy.cpp │ │ ├── apex_dump.cpp │ │ ├── apex_exit.cpp │ │ ├── apex_exit_thread.cpp │ │ ├── apex_fibonacci_std_async.cpp │ │ ├── apex_fibonacci_std_async2.cpp │ │ ├── apex_finalize.cpp │ │ ├── apex_get_profile.cpp │ │ ├── apex_get_thread_cap.cpp │ │ ├── apex_hpx_annotated_functions.cpp │ │ ├── apex_hpx_direct_actions.cpp │ │ ├── apex_hpx_task_wrapper_direct_actions.cpp │ │ ├── apex_init.cpp │ │ ├── apex_init_args.cpp │ │ ├── apex_malloc.cpp │ │ ├── apex_multiple_parents.cpp │ │ ├── apex_new_task.cpp │ │ ├── apex_non_worker_thread.cpp │ │ ├── apex_openmp.cpp │ │ ├── apex_print_options.cpp │ │ ├── apex_profiler_guids.cpp │ │ ├── apex_pthread_flood.cpp │ │ ├── apex_register_custom_event.cpp │ │ ├── apex_register_periodic_policy.cpp │ │ ├── apex_register_policy.cpp │ │ ├── apex_register_policy_set.cpp │ │ ├── apex_register_thread.cpp │ │ ├── apex_reset.cpp │ │ ├── apex_resume.cpp │ │ ├── apex_sample_value.cpp │ │ ├── apex_set_state.cpp │ │ ├── apex_setup_throughput_tuning.cpp │ │ ├── apex_setup_timer_throttling.cpp │ │ ├── apex_shutdown_throttling.cpp │ │ ├── apex_start.cpp │ │ ├── apex_std_thread.cpp │ │ ├── apex_stop.cpp │ │ ├── apex_stop_all_async_threads.cpp │ │ ├── apex_swap_threads.cpp │ │ ├── apex_task_wrapper.cpp │ │ ├── apex_task_wrapper2.cpp │ │ ├── apex_taskstubs.cpp │ │ ├── apex_throttle_event.cpp │ │ ├── apex_untied_timer_stack.cpp │ │ ├── apex_untied_timer_stack_pooled.cpp │ │ ├── apex_version.cpp │ │ └── apex_yield.cpp │ ├── C │ │ ├── CMakeLists.txt │ │ ├── apex_cleanup.c │ │ ├── apex_cross_thread_timing.c │ │ ├── apex_current_power_high.c │ │ ├── apex_custom_event.c │ │ ├── apex_deregister_policy.c │ │ ├── apex_disable.c │ │ ├── apex_dump.c │ │ ├── apex_exit_thread.c │ │ ├── apex_fibonacci_pthread.c │ │ ├── apex_finalize.c │ │ ├── apex_get_idle_rate.c │ │ ├── apex_get_profile.c │ │ ├── apex_get_thread_cap.c │ │ ├── apex_init.c │ │ ├── apex_init_args.c │ │ ├── apex_new_task.c │ │ ├── apex_openacc.c │ │ ├── apex_papi_suspend.c │ │ ├── apex_print_options.c │ │ ├── apex_register_custom_event.c │ │ ├── apex_register_periodic_policy.c │ │ ├── apex_register_policy.c │ │ ├── apex_register_thread.c │ │ ├── apex_reset.c │ │ ├── apex_resume.c │ │ ├── apex_sample_value.c │ │ ├── apex_set_state.c │ │ ├── apex_setup_timer_throttling.c │ │ ├── apex_shutdown_throttling.c │ │ ├── apex_start.c │ │ ├── apex_stop.c │ │ ├── apex_suspend.c │ │ ├── apex_throttle_event.c │ │ ├── apex_version.c │ │ ├── apex_yield.c │ │ └── crasher.c │ ├── CUDA │ │ ├── CMakeLists.txt │ │ ├── allocation.hpp │ │ ├── apex_cuda.cu │ │ ├── apex_multi_cuda.cu │ │ ├── apex_p2p.cu │ │ ├── apex_ping_pong.cu │ │ ├── apex_ring_dtod.cu │ │ ├── apex_vector.cu │ │ ├── exception.h │ │ ├── helper_cuda.h │ │ ├── helper_functions.h │ │ ├── helper_image.h │ │ ├── helper_string.h │ │ ├── helper_timer.h │ │ ├── multiGpuThread.cu │ │ ├── pi.cu │ │ ├── timer.hpp │ │ ├── util_cuda.cu │ │ ├── util_cuda.hpp │ │ └── util_mpi.hpp │ ├── HIP │ │ ├── CMakeLists.txt │ │ ├── MatrixTranspose.cpp │ │ └── repro_managed_slowness.cpp │ ├── Kokkos │ │ ├── CMakeLists.txt │ │ ├── mm2d_tiling.cpp │ │ ├── simple.cpp │ │ ├── tuning_playground.hpp │ │ └── two_var.cpp │ ├── MPI │ │ ├── CMakeLists.txt │ │ ├── mpi_cpi.c │ │ └── mpi_divergent.c │ └── opencl │ │ ├── CMakeLists.txt │ │ └── opencl_matmult.cpp ├── utils │ ├── CMakeLists.txt │ ├── apex_environment_help.cpp │ ├── apex_header.cpp │ └── apex_make_default_config.cpp └── wrappers │ ├── CMakeLists.txt │ ├── dl_auditor.c │ ├── memory_wrapper.cpp │ ├── memory_wrapper.h │ ├── memory_wrapper_internal.cpp │ ├── pthread_wrapper.c │ ├── pthread_wrapper.h │ └── pthread_wrapper_internal.cpp └── todo.txt /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | build-* 3 | build_* 4 | test 5 | doc/webdocs/site 6 | install* 7 | *.swp 8 | regression* 9 | *.sh 10 | *DS_Store 11 | concurrentqueue 12 | perfstubs 13 | rapidjson 14 | taskgraph*dot 15 | apex*csv 16 | trace_events.*.json 17 | OTF2_archive 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "kokkos"] 2 | path = kokkos 3 | url = https://github.com/kokkos/kokkos 4 | [submodule "perfstubs"] 5 | branch = python-3.12 6 | -------------------------------------------------------------------------------- /README.intel_mic: -------------------------------------------------------------------------------- 1 | To build for Intel MIC, please see the bootstrap script for mic-linux. 2 | The most salient points are to set these environment variables: 3 | export CC=icc 4 | export CXX=icpc 5 | export FC=ifort 6 | export CFLAGS="-mmic -DBOOST_NO_CXX11_ALLOCATOR" 7 | export CXXFLAGS=$CFLAGS 8 | export FFLAGS=$CFLAGS 9 | export MPI_C=mpiicc 10 | export MPI_CXX=mpiicpc 11 | And use this CMake toolchain file: 12 | -DCMAKE_TOOLCHAIN_FILE=${apex_src_dir}/cmake/Modules/intel_mic_toolchain.cmake 13 | 14 | 15 | After building, use these commands to run (with equivalent paths): 16 | 17 | SINK_LD_LIBRARY_PATH=/home/users/khuck/src/xpress-apex/build_2016.01.29-12.57.22/src/apex:/home/users/khuck/install/mic/boost/1.58.0/lib:/packages/intel/16/linux/compiler/lib/mic 18 | 19 | micnativeloadex build_2016.01.29-12.57.22/src/unit_tests/C/apex_init -------------------------------------------------------------------------------- /bootstrap-configs/README.edison: -------------------------------------------------------------------------------- 1 | NOTE: On edison, make sure you make the following module changes 2 | before running the bootstrap-edison.sh script: 3 | 4 | module swap PrgEnv-intel PrgEnv-gnu 5 | module load gcc/4.9.2 6 | module load cmake/2.8.12.2 7 | module load boost 8 | module load automake/1.14 9 | module load autoconf 10 | module load craype-hugepages8M 11 | module unload cray-shmem 12 | module unload darshan 13 | 14 | When building APEX for use with HPX, do NOT use the MPI bootstrap script. 15 | When building APEX for use in an MPI application, DO use the MPI bootstrap script. 16 | -------------------------------------------------------------------------------- /bootstrap-configs/dependencies/build-papi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # get how many cores we have to use for the build 4 | procs=1 5 | if [ -f '/proc/cpuinfo' ] ; then 6 | procs=`grep -c ^processor /proc/cpuinfo` 7 | fi 8 | 9 | # build PAPI 10 | # ------------------------------------------------------------------------ 11 | 12 | #configure parameters 13 | version=5.3.2 14 | papi_root=`pwd`/papi-$version 15 | 16 | # get the papi tarball 17 | file=papi-$version.tar.gz 18 | if [ ! -f $file ] ; then 19 | wget http://icl.cs.utk.edu/projects/papi/downloads/$file 20 | fi 21 | tar -xvzf $file 22 | 23 | # configure and build 24 | cd papi-$version/src 25 | ./configure --prefix=$papi_root 26 | make -j `expr $procs + 1` 27 | make install 28 | cd ../.. 29 | 30 | echo "PAPI is installed in $papi_root" 31 | -------------------------------------------------------------------------------- /bootstrap-configs/dependencies/build-tau.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | papi_root=`pwd`/papi-5.3.2 4 | 5 | # NO NEED TO MODIFY ANYTHING BELOW THIS LINE 6 | # ------------------------------------------------------------------------ 7 | 8 | # get how many cores we have to use for the build 9 | procs=1 10 | if [ -f '/proc/cpuinfo' ] ; then 11 | procs=`grep -c ^processor /proc/cpuinfo` 12 | fi 13 | 14 | # To build TAU 15 | # ------------------------------------------------------------------------ 16 | 17 | #configure parameters 18 | version=tau2-git-latest 19 | export TAU_ROOT=`pwd`/$version 20 | 21 | # get the tarball 22 | file=$version.tar.gz 23 | if [ ! -f $file ] ; then 24 | wget http://www.nic.uoregon.edu/~khuck/$file 25 | fi 26 | tar -xvzf $file 27 | 28 | # configure and build 29 | cd $TAU_ROOT 30 | ./configure -pthread -bfd=download -unwind=download -tag=hpx -papi=$papi_root 31 | 32 | make -j `expr $procs + 1` install 33 | 34 | echo "" 35 | echo "TAU build complete." 36 | echo "Set the TAU_ROOT environment variable to $TAU_ROOT." 37 | echo "Add $TAU_ROOT/`./utils/archfind`/bin to your path." 38 | echo "Add $papi_root/bin to your path." 39 | 40 | cd .. 41 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_Distclean.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Bryce Lelbach 2 | # Copyright (c) 2003 Jan Woetzel 3 | # 4 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | # cleans and removes cmake generated files etc. 7 | 8 | if(UNIX) 9 | add_custom_target(distclean @echo Completed distclean, you may now re-run CMake.) 10 | 11 | add_custom_command( 12 | DEPENDS clean 13 | COMMAND rm 14 | ARGS -f CMakeCache.txt 15 | TARGET distclean) 16 | endif() 17 | 18 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_GetIncludeDirectory.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Bryce Lelbach 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | set(APEX_GETINCLUDEDIRECTORY_LOADED TRUE) 7 | 8 | macro(apex_get_include_directory variable) 9 | set(dir "") 10 | if(apex_SOURCE_DIR) 11 | set(dir "-I${apex_SOURCE_DIR}") 12 | elseif(APEX_ROOT) 13 | set(dir "-I${APEX_ROOT}/include") 14 | elseif($ENV{APEX_ROOT}) 15 | set(dir "-I$ENV{APEX_ROOT}/include") 16 | endif() 17 | 18 | set(${variable} "${dir}") 19 | endmacro() 20 | 21 | ############################################################################### 22 | # prevent undefined variables from messing up the compilation flags 23 | macro(apex_get_boost_include_directory variable) 24 | if(NOT BOOST_INCLUDE_DIR) 25 | set(${variable} "") 26 | else() 27 | set(${variable} "-I${BOOST_INCLUDE_DIR}") 28 | endif() 29 | endmacro() 30 | 31 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_Include.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Bryce Lelbach 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | macro(apex_include) 7 | foreach(listfile ${ARGV}) 8 | string(TOUPPER "APEX_${listfile}_LOADED" detector) 9 | if(NOT ${detector}) 10 | include("APEX_${listfile}") 11 | endif() 12 | endforeach() 13 | endmacro() 14 | 15 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_ListContains.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2007-2012 Hartmut Kaiser 2 | # Copyright (c) 2011 Bryce Lelbach 3 | # Copyright (c) 2010-2011 Alexander Neundorf 4 | # 5 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | set(APEX_LISTCONTAINS_LOADED TRUE) 9 | 10 | macro(apex_list_contains output needle) 11 | set(${output}) 12 | foreach(value ${ARGN}) 13 | if(${needle} STREQUAL ${value}) 14 | set(${output} TRUE) 15 | break() 16 | endif() 17 | endforeach() 18 | endmacro() 19 | 20 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_Option.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Bryce Lelbach 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # FIXME: Use parse arg. 7 | 8 | set(APEX_OPTION_LOADED TRUE) 9 | 10 | macro(apex_option option type description default) 11 | if(DEFINED ${option}) 12 | set(${option} "${${option}}" CACHE ${type} ${description} FORCE) 13 | else() 14 | set(${option} "${default}" CACHE ${type} ${description} FORCE) 15 | endif() 16 | 17 | foreach(arg ${ARGN}) 18 | if(arg STREQUAL "ADVANCED") 19 | mark_as_advanced(FORCE ${option}) 20 | else() 21 | apex_error("option" "Unknown argument while calling apex_option: ${arg} (only allowed value: 'ADVANCED')") 22 | endif() 23 | endforeach() 24 | endmacro() 25 | 26 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_ParseArguments.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2007-2012 Hartmut Kaiser 2 | # Copyright (c) 2011 Bryce Lelbach 3 | # Copyright (c) 2010-2011 Alexander Neundorf 4 | # 5 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | set(APEX_PARSEARGUMENTS_LOADED TRUE) 9 | 10 | include(APEX_Include) 11 | 12 | apex_include(ListContains) 13 | 14 | macro(apex_parse_arguments prefix arg_names option_names) 15 | set(DEFAULT_ARGS) 16 | 17 | foreach(arg_name ${arg_names}) 18 | set(${prefix}_${arg_name}) 19 | endforeach() 20 | 21 | foreach(option ${option_names}) 22 | set(${prefix}_${option} FALSE) 23 | endforeach() 24 | 25 | set(current_arg_name DEFAULT_ARGS) 26 | set(current_arg_list) 27 | 28 | foreach(arg ${ARGN}) 29 | apex_list_contains(is_arg_name ${arg} ${arg_names}) 30 | if(is_arg_name) 31 | set(${prefix}_${current_arg_name} ${current_arg_list}) 32 | set(current_arg_name ${arg}) 33 | set(current_arg_list) 34 | else() 35 | apex_list_contains(is_option ${arg} ${option_names}) 36 | if(is_option) 37 | set(${prefix}_${arg} TRUE) 38 | else() 39 | set(current_arg_list ${current_arg_list} ${arg}) 40 | endif() 41 | endif() 42 | endforeach() 43 | 44 | set(${prefix}_${current_arg_name} ${current_arg_list}) 45 | endmacro() 46 | 47 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupActiveHarmony.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | if(APEX_WITH_ACTIVEHARMONY) 7 | 8 | find_package(ACTIVEHARMONY) 9 | if(NOT ACTIVEHARMONY_FOUND) 10 | hpx_error("apex" "Requested APEX_WITH_ACTIVEHARMONY but could not find \ 11 | Active Harmony. Please specify ACTIVEHARMONY_ROOT.") 12 | endif() 13 | 14 | # Add an imported target 15 | add_library(activeharmony INTERFACE IMPORTED) 16 | hpx_info("apex" "Building APEX with Active Harmony support.") 17 | set_property(TARGET activeharmony PROPERTY 18 | INTERFACE_INCLUDE_DIRECTORIES ${ACTIVEHARMONY_INCLUDE_DIR}) 19 | set_property(TARGET activeharmony PROPERTY 20 | INTERFACE_LINK_LIBRARIES ${ACTIVEHARMONY_LIBRARIES}) 21 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${ACTIVEHARMONY_LIBRARY_DIR}) 22 | 23 | # Add the right definitions to the apex_flags target 24 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_ACTIVEHARMONY) 25 | 26 | list(APPEND _apex_imported_targets activeharmony) 27 | 28 | else() 29 | 30 | add_custom_target(project_activeharmony) 31 | 32 | endif() 33 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupBFD.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | find_package(BFD) 7 | 8 | if (BFD_FOUND) 9 | 10 | add_library(bfd INTERFACE IMPORTED) 11 | set_property(TARGET bfd PROPERTY 12 | INTERFACE_INCLUDE_DIRECTORIES ${BFD_INCLUDE_DIRS}) 13 | set_property(TARGET bfd PROPERTY 14 | INTERFACE_LINK_LIBRARIES ${BFD_LIBRARIES}) 15 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${BFD_LIBRARY_DIR}) 16 | message(INFO " Using binutils: ${BFD_LIBRARY_DIR} ${BFD_LIBRARIES}") 17 | 18 | list(APPEND _apex_imported_targets bfd) 19 | 20 | endif() 21 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupCUPTI.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2021 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | if(APEX_WITH_CUDA) 7 | enable_language(CUDA) 8 | find_package(CUDAToolkit REQUIRED QUIET COMPONENTS CUPTI NVML) 9 | find_package(CUPTI REQUIRED QUIET COMPONENTS CUPTI) 10 | #find_package(NVML REQUIRED QUIET COMPONENTS NVML) 11 | 12 | # Add an imported target 13 | add_library(cuda INTERFACE IMPORTED) 14 | add_library(cupti INTERFACE IMPORTED) 15 | add_library(nvidia-ml INTERFACE IMPORTED) 16 | hpx_info("apex" "Building APEX with CUDA/CUPTI support.") 17 | set_property(TARGET cupti PROPERTY 18 | INTERFACE_INCLUDE_DIRECTORIES ${CUPTI_INCLUDE_DIRS}) 19 | set_property(TARGET cuda PROPERTY 20 | INTERFACE_LINK_LIBRARIES ${CUDA_LIBRARY}) 21 | set_property(TARGET cupti PROPERTY 22 | INTERFACE_LINK_LIBRARIES ${CUPTI_LIBRARIES}) 23 | 24 | #set_property(TARGET nvidia-ml PROPERTY 25 | # INTERFACE_INCLUDE_DIRECTORIES ${NVML_INCLUDE_DIRS}) 26 | set_property(TARGET nvidia-ml PROPERTY 27 | INTERFACE_LINK_LIBRARIES CUDA::nvml) 28 | 29 | # Add the right definitions to the apex_flags target 30 | target_compile_definitions(apex_flags INTERFACE APEX_WITH_CUDA) 31 | 32 | list(APPEND _apex_imported_targets cudart) 33 | list(APPEND _apex_imported_targets cupti) 34 | list(APPEND _apex_imported_targets nvidia-ml) 35 | 36 | else() 37 | add_custom_target(project_cuda) 38 | endif() 39 | 40 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupDemangle.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | find_package(DEMANGLE) 7 | 8 | if (DEMANGLE_FOUND) 9 | 10 | # Add an imported target 11 | add_library(demangle INTERFACE IMPORTED) 12 | set_property(TARGET demangle PROPERTY 13 | INTERFACE_INCLUDE_DIRECTORIES ${DEMANGLE_INCLUDE_DIRS}) 14 | set_property(TARGET demangle PROPERTY 15 | INTERFACE_LINK_LIBRARIES ${DEMANGLE_LIBRARIES}) 16 | 17 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${DEMANGLE_LIBRARY_DIR}) 18 | message(INFO " Using demangle: ${DEMANGLE_LIBRARY_DIR} ${DEMANGLE_LIBRARIES}") 19 | 20 | list(APPEND _apex_imported_targets demangle) 21 | 22 | else() 23 | 24 | unset(DEMANGLE_LIBRARY) 25 | unset(DEMANGLE_LIBRARIES) 26 | unset(DEMANGLE_DIR) 27 | 28 | endif() 29 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupHPXMP.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | add_library(hpxmp INTERFACE IMPORTED) 7 | set_property(TARGET hpxmp PROPERTY 8 | INTERFACE_INCLUDE_DIRECTORIES ${HPXMP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/hpxmp/src) 9 | set_property(TARGET hpxmp PROPERTY 10 | INTERFACE_LINK_LIBRARIES ${HPXMP_LIBRARIES}) 11 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${HPXMP_LIBRARY_DIR}) 12 | message(INFO " Using binutils: ${HPXMP_LIBRARY_DIR} ${HPXMP_LIBRARIES}") 13 | 14 | list(APPEND _apex_imported_targets hpxmp) 15 | 16 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupKokkos.cmake: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Kokkos configuration - needed for HPX integration support 4 | ################################################################################ 5 | 6 | if(APEX_WITH_KOKKOS) 7 | message(INFO " Checking for Kokkos installation in $Kokkos_ROOT...") 8 | find_package(Kokkos) 9 | if (Kokkos_FOUND) 10 | message(INFO " Using Kokkos include: ${Kokkos_INCLUDE_DIRS}/impl") 11 | include_directories(${Kokkos_INCLUDE_DIRS}/impl) 12 | else() 13 | message(INFO " Kokkos not found, cloning submodule to get required headers.") 14 | include(AddGitSubmodule) 15 | add_git_submodule(${CMAKE_CURRENT_SOURCE_DIR}/../../kokkos FALSE) 16 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../kokkos/core/src/impl) 17 | endif() 18 | endif() 19 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupLMSensors.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ################################################################################ 7 | # LM Sensors configuration 8 | ################################################################################ 9 | 10 | # Setup an imported target for lmsensors 11 | if(APEX_WITH_LM_SENSORS) 12 | 13 | find_package(LM_SENSORS) 14 | 15 | if (NOT LM_SENSORS_FOUND) 16 | hpx_error("apex" "Requested APEX_WITH_LM_SENSORS but could not find LM \ 17 | Sensors. Please specify LM_SENSORS_ROOT.") 18 | endif() 19 | 20 | # Add an imported target 21 | add_library(lm_sensors INTERFACE IMPORTED) 22 | set_property(TARGET lm_sensors PROPERTY 23 | INTERFACE_INCLUDE_DIRECTORIES ${LM_SENSORS_INCLUDE_DIRS}) 24 | set_property(TARGET lm_sensors PROPERTY 25 | INTERFACE_LINK_LIBRARIES ${LM_SENSORS_LIBRARIES}) 26 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${LM_SENSORS_LIBRARY_DIR}) 27 | 28 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_LM_SENSORS) 29 | 30 | list(APPEND _apex_imported_targets lm_sensors) 31 | 32 | endif() 33 | 34 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupMPI.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # Setup an imported target for mpi 7 | if(APEX_WITH_MPI) 8 | 9 | find_package(MPI) 10 | if(NOT MPI_FOUND) 11 | hpx_error("apex" "Requested APEX_WITH_MPI but could not find MPI.") 12 | endif() 13 | hpx_info("apex" "Building APEX with MPI support.") 14 | 15 | # Add an imported target 16 | add_library(mpi INTERFACE IMPORTED) 17 | set_property(TARGET mpi PROPERTY 18 | INTERFACE_INCLUDE_DIRECTORIES ${MPI_INCLUDE_DIR}) 19 | set_property(TARGET mpi PROPERTY 20 | INTERFACE_LINK_LIBRARIES ${MPI_LIBRARIES}) 21 | 22 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${MPI_LIBRARY_DIR}) 23 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_MPI) 24 | 25 | list(APPEND _apex_imported_targets mpi) 26 | add_definitions(-DAPEX_HAVE_MPI) 27 | 28 | endif() 29 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupMSR.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | if(APEX_WITH_MSR) 7 | 8 | find_package(MSR) 9 | if(NOT MSR_FOUND) 10 | hpx_error("apex" "Requested APEX_WITH_MSR but could not find MSR. \ 11 | Please specify MSR_ROOT.") 12 | endif() 13 | hpx_info("apex" "Building APEX with libmsr support.") 14 | 15 | # Add an imported target 16 | add_library(msr INTERFACE IMPORTED) 17 | set_property(TARGET msr PROPERTY 18 | INTERFACE_INCLUDE_DIRECTORIES ${MSR_INCLUDE_DIR}) 19 | set_property(TARGET msr PROPERTY 20 | INTERFACE_LINK_LIBRARIES ${MSR_LIBRARIES}) 21 | 22 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${MSR_LIBRARY_DIR}) 23 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_MSR) 24 | 25 | list(APPEND _apex_imported_targets msr) 26 | 27 | endif() 28 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupOTF2.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | if(APEX_WITH_OTF2) 7 | 8 | find_package(OTF2 REQUIRED) 9 | if (NOT OTF2_FOUND) 10 | hpx_error("apex" "Requested APEX_WITH_OTF2 but could not find OTF2 library. Please specify OTF2_ROOT.") 11 | endif() 12 | 13 | # Add an imported target 14 | add_library(otf2 INTERFACE IMPORTED) 15 | set_property(TARGET otf2 PROPERTY 16 | INTERFACE_INCLUDE_DIRECTORIES ${OTF2_INCLUDE_DIRS}) 17 | set_property(TARGET otf2 PROPERTY 18 | INTERFACE_LINK_LIBRARIES ${OTF2_LIBRARIES}) 19 | 20 | set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${OTF2_LIBRARY_DIR}) 21 | 22 | list(APPEND _apex_imported_targets otf2) 23 | 24 | else() 25 | add_custom_target(project_otf2) 26 | endif() 27 | 28 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupPAPI.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # Setup an imported target for papi 7 | if(APEX_WITH_PAPI) 8 | 9 | find_package(PAPI) 10 | if(NOT PAPI_FOUND) 11 | hpx_error("apex" "Requested APEX_WITH_PAPI but could not find PAPI. Please specify PAPI_ROOT.") 12 | endif() 13 | hpx_info("apex" "Building APEX with PAPI support.") 14 | 15 | # Add an imported target 16 | add_library(papi INTERFACE IMPORTED) 17 | set_property(TARGET papi PROPERTY 18 | INTERFACE_INCLUDE_DIRECTORIES ${PAPI_INCLUDE_DIR}) 19 | set_property(TARGET papi PROPERTY 20 | INTERFACE_LINK_LIBRARIES ${PAPI_LIBRARIES}) 21 | 22 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${PAPI_LIBRARY_DIR}) 23 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_PAPI) 24 | 25 | list(APPEND _apex_imported_targets papi) 26 | 27 | endif() 28 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupPlugins.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | if(APEX_WITH_PLUGINS) 7 | message(INFO " apex will be built with plugin support.") 8 | set(LIBS ${LIBS} ${CMAKE_DL_LIBS}) 9 | target_compile_definitions(apex_flags INTERFACE APEX_WITH_PLUGINS) 10 | endif() 11 | 12 | # Regardless, APEX now depends on JSON for event filtering support. 13 | # So make sure that we have the rapidjson library. 14 | 15 | include(GitExternal) 16 | git_external(rapidjson 17 | https://github.com/miloyip/rapidjson.git 18 | master 19 | VERBOSE) 20 | 21 | find_path( 22 | RAPIDJSON_INCLUDE_DIR 23 | NAMES rapidjson 24 | PATHS ${APEX_SOURCE_DIR}/rapidjson/include) 25 | 26 | add_library(rapidjson INTERFACE IMPORTED) 27 | if(RAPIDJSON_INCLUDE_DIR) 28 | message(INFO " Found rapidjson at ${RAPIDJSON_INCLUDE_DIR}") 29 | set_property(TARGET rapidjson PROPERTY 30 | INTERFACE_INCLUDE_DIRECTORIES ${RAPIDJSON_INCLUDE_DIR}) 31 | list(APPEND _apex_imported_targets rapidjson) 32 | else() 33 | message(FATAL_ERROR " rapidjson not found. This should have been checked \ 34 | out automatically. " "Try manually check out \ 35 | https://github.com/miloyip/rapidjson.git to ${PROJECT_SOURCE_DIR}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_SetupZlib.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 University of Oregon 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # Setup an imported target for zlib 7 | find_package(ZLIB) 8 | if(ZLIB_FOUND) 9 | hpx_info("apex" "Building APEX with ZLIB support.") 10 | 11 | # Add an imported target 12 | add_library(zlib INTERFACE IMPORTED) 13 | set_property(TARGET zlib PROPERTY 14 | INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}) 15 | set_property(TARGET zlib PROPERTY 16 | INTERFACE_LINK_LIBRARIES ${ZLIB_LIBRARIES}) 17 | 18 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${ZLIB_LIBRARY_DIR}) 19 | target_compile_definitions(apex_flags INTERFACE APEX_HAVE_ZLIB) 20 | message(INFO " Using zlib: ${ZLIB_INCLUDE_DIR}") 21 | message(INFO " Using zlib: ${ZLIB_LIBRARY_DIR} ${ZLIB_LIBRARIES}") 22 | 23 | list(APPEND _apex_imported_targets zlib) 24 | 25 | endif() 26 | -------------------------------------------------------------------------------- /cmake/Modules/APEX_Utils.cmake: -------------------------------------------------------------------------------- 1 | ## force out of tree build 2 | 3 | set(APEX_FORCEOUTOFTREEBUILD_LOADED TRUE) 4 | 5 | include(APEX_Include) 6 | 7 | apex_include(Message) 8 | 9 | macro(apex_force_out_of_tree_build message) 10 | string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}" insource) 11 | get_filename_component(parentdir ${PROJECT_SOURCE_DIR} PATH) 12 | string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${parentdir}" insourcesubdir) 13 | if(insource OR insourcesubdir) 14 | apex_error("in_tree" "${message}") 15 | endif() 16 | endmacro() 17 | 18 | 19 | -------------------------------------------------------------------------------- /cmake/Modules/ActiveHarmony.patch: -------------------------------------------------------------------------------- 1 | --- a/code-server/code_generator.cxx 2 | +++ b/code-server/code_generator.cxx 3 | @@ -574,13 +574,13 @@ int parse_slave_list(const char* hostlist) 4 | } 5 | 6 | // Skip leading whitespace. 7 | - while (head < tail && (head == '\0' || isspace(*head))) { 8 | + while (head < tail && (*head == '\0' || isspace(*head))) { 9 | ++head; 10 | } 11 | host_ptr = head; 12 | 13 | // Find host boundary whitespace. 14 | - while (head < tail && (head != '\0' && !isspace(*head))) { 15 | + while (head < tail && (*head != '\0' && !isspace(*head))) { 16 | ++head; 17 | } 18 | host = string(host_ptr, head++); 19 | @@ -596,7 +596,7 @@ int parse_slave_list(const char* hostlist) 20 | } 21 | 22 | // Skip trailing whitespace. 23 | - while (head < tail && (head == '\0' || isspace(*head))) { 24 | + while (head < tail && (*head == '\0' || isspace(*head))) { 25 | ++head; 26 | } 27 | -------------------------------------------------------------------------------- /cmake/Modules/FindCUPTI.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibCUPTI 2 | # Once done this will define 3 | # CUPTI_FOUND - System has CUPTI 4 | # CUPTI_INCLUDE_DIRS - The CUPTI include directories 5 | # CUPTI_LIBRARIES - The libraries needed to use CUPTI 6 | # CUPTI_DEFINITIONS - Compiler switches required for using CUPTI 7 | 8 | if(NOT DEFINED $CUPTI_ROOT) 9 | if(DEFINED ENV{CUPTI_ROOT}) 10 | # message(" env CUPTI_ROOT is defined as $ENV{CUPTI_ROOT}") 11 | set(CUPTI_ROOT $ENV{CUPTI_ROOT}) 12 | endif() 13 | endif() 14 | 15 | if(NOT DEFINED $CUPTI_ROOT AND CUDAToolkit_FOUND) 16 | message(INFO " env CUPTI_ROOT is assuming ${CUDAToolkit_INCLUDE_DIRS}/..") 17 | set(CUPTI_ROOT "${CUDAToolkit_INCLUDE_DIRS}/../extras/CUPTI") 18 | endif() 19 | 20 | find_path(CUPTI_INCLUDE_DIR NAMES cupti.h 21 | HINTS ${CUDAToolkit_INCLUDE_DIRS} ${CUPTI_ROOT}/include) 22 | 23 | find_library(CUPTI_LIBRARY NAMES cupti 24 | HINTS ${CUDAToolkit_LIBRARY_DIR} ${CUPTI_ROOT} ${CUPTI_ROOT}/lib64 ${CUPTI_ROOT}/lib) 25 | 26 | find_library(CUDA_LIBRARY NAMES cudart 27 | HINTS ${CUDAToolkit_LIBRARY_DIR}) 28 | 29 | include(FindPackageHandleStandardArgs) 30 | # handle the QUIETLY and REQUIRED arguments and set CUPTI_FOUND to TRUE 31 | # if all listed variables are TRUE 32 | find_package_handle_standard_args(CUPTI DEFAULT_MSG 33 | CUPTI_LIBRARY CUPTI_INCLUDE_DIR) 34 | 35 | mark_as_advanced(CUPTI_INCLUDE_DIR CUPTI_LIBRARY) 36 | 37 | if(CUPTI_FOUND) 38 | set(CUPTI_LIBRARIES ${CUDA_LIBRARY} ${CUPTI_LIBRARY} ) 39 | set(CUPTI_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIRS} ${CUPTI_INCLUDE_DIR}) 40 | set(CUPTI_DIR ${CUPTI_ROOT}) 41 | add_definitions(-DAPEX_HAVE_CUPTI) 42 | endif() 43 | 44 | -------------------------------------------------------------------------------- /cmake/Modules/FindKokkos.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibKokkos 2 | # Once done this will define 3 | # Kokkos_FOUND - System has Kokkos 4 | # Kokkos_INCLUDE_DIRS - The Kokkos include directories 5 | # Kokkos_LIBRARIES - The libraries needed to use Kokkos 6 | # Kokkos_DEFINITIONS - Compiler switches required for using Kokkos 7 | 8 | if(NOT DEFINED $Kokkos_ROOT) 9 | if(DEFINED ENV{Kokkos_ROOT}) 10 | # message(" env Kokkos_ROOT is defined as $ENV{Kokkos_ROOT}") 11 | set(Kokkos_ROOT $ENV{Kokkos_ROOT}) 12 | endif() 13 | endif() 14 | 15 | message("Kokkos_ROOT is defined as ${Kokkos_ROOT}") 16 | 17 | find_path(Kokkos_INCLUDE_DIR NAMES Kokkos_Core.hpp 18 | HINTS ${Kokkos_ROOT}/include $ENV{Kokkos_ROOT}/include) 19 | find_library(Kokkos_LIBRARY NAMES kokkoscore 20 | HINTS ${Kokkos_ROOT}/* $ENV{Kokkos_ROOT}/*) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | # handle the QUIETLY and REQUIRED arguments and set Kokkos_FOUND to TRUE 24 | # if all listed variables are TRUE 25 | find_package_handle_standard_args(Kokkos DEFAULT_MSG 26 | Kokkos_LIBRARY Kokkos_INCLUDE_DIR) 27 | 28 | mark_as_advanced(Kokkos_INCLUDE_DIR Kokkos_LIBRARY) 29 | 30 | if(Kokkos_FOUND) 31 | set(Kokkos_INCLUDE_DIRS ${Kokkos_INCLUDE_DIR}) 32 | set(Kokkos_DIR ${Kokkos_ROOT}) 33 | add_definitions(-DAPEX_HAVE_KOKKOS) 34 | endif() 35 | 36 | -------------------------------------------------------------------------------- /cmake/Modules/FindLEVEL0.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibLEVEL0 2 | # Once done this will define 3 | # LEVEL0_FOUND - System has LEVEL0 4 | # LEVEL0_INCLUDE_DIRS - The LEVEL0 include directories 5 | # LEVEL0_LIBRARIES - The libraries needed to use LEVEL0 6 | # LEVEL0_DEFINITIONS - Compiler switches required for using LEVEL0 7 | 8 | if(NOT DEFINED $LEVEL0_ROOT) 9 | if(DEFINED ENV{LEVEL0_ROOT}) 10 | # message(" env LEVEL0_ROOT is defined as $ENV{LEVEL0_ROOT}") 11 | set(LEVEL0_ROOT $ENV{LEVEL0_ROOT}) 12 | endif() 13 | endif() 14 | 15 | find_path(LEVEL0_INCLUDE_DIR NAMES level_zero/ze_api.h 16 | HINTS ${LEVEL0_ROOT}/include /usr ${LEVEL0_ROOT}) 17 | 18 | find_library(LEVEL0_LIBRARY NAMES ze_loader 19 | HINTS ${LEVEL0_ROOT} ${LEVEL0_ROOT}/lib64 ${LEVEL0_ROOT}/lib /usr/lib64 /usr/lib) 20 | 21 | include(FindPackageHandleStandardArgs) 22 | # handle the QUIETLY and REQUIRED arguments and set LEVEL0_FOUND to TRUE 23 | # if all listed variables are TRUE 24 | find_package_handle_standard_args(LEVEL0 DEFAULT_MSG 25 | LEVEL0_LIBRARY LEVEL0_INCLUDE_DIR) 26 | 27 | mark_as_advanced(LEVEL0_INCLUDE_DIR LEVEL0_LIBRARY) 28 | 29 | if(LEVEL0_FOUND) 30 | set(LEVEL0_LIBRARIES ${LEVEL0_LIBRARY} ) 31 | set(LEVEL0_INCLUDE_DIRS ${LEVEL0_INCLUDE_DIR}) 32 | set(LEVEL0_DIR ${LEVEL0_ROOT}) 33 | add_definitions(-DAPEX_HAVE_LEVEL0) 34 | endif() 35 | 36 | -------------------------------------------------------------------------------- /cmake/Modules/FindLM_SENSORS.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LM_SENSORS 2 | # Once done this will define 3 | # LM_SENSORS_FOUND - True if LM_SENSORS found. 4 | # LM_SENSORS_INCLUDE_DIR - where to find LM_SENSORS.h, etc. 5 | # LM_SENSORS_LIBRARIES - List of libraries when using LM_SENSORS. 6 | 7 | 8 | if(NOT DEFINED $LM_SENSORS_ROOT) 9 | if(DEFINED ENV{LM_SENSORS_ROOT}) 10 | # message(" env LM_SENSORS_ROOT is defined as $ENV{LM_SENSORS_ROOT}") 11 | set(LM_SENSORS_ROOT $ENV{LM_SENSORS_ROOT}) 12 | endif() 13 | endif() 14 | 15 | find_path(LM_SENSORS_INCLUDE_DIR sensors/sensors.h 16 | HINTS ${LM_SENSORS_ROOT}/include 17 | /opt/local/include /usr/local/include /usr/include) 18 | 19 | find_library(LM_SENSORS_LIBRARY NAMES sensors 20 | HINTS ${LM_SENSORS_ROOT}/lib 21 | /usr/lib /usr/lib64 /usr/local/lib /opt/local/lib) 22 | 23 | 24 | 25 | 26 | include(FindPackageHandleStandardArgs) 27 | # handle the QUIETLY and REQUIRED arguments and set LM_SENSORS_FOUND to TRUE 28 | # if all listed variables are TRUE 29 | find_package_handle_standard_args(LM_SENSORS DEFAULT_MSG 30 | LM_SENSORS_LIBRARY LM_SENSORS_INCLUDE_DIR) 31 | 32 | mark_as_advanced(LM_SENSORS_INCLUDE_DIR LM_SENSORS_LIBRARY) 33 | 34 | if (LM_SENSORS_FOUND) 35 | set(LM_SENSORS_LIBRARIES ${LM_SENSORS_LIBRARY} ) 36 | set(LM_SENSORS_INCLUDE_DIRS ${LM_SENSORS_INCLUDE_DIR}) 37 | set(LM_SENSORS_DIR ${LM_SENSORS_ROOT}) 38 | add_definitions(-DAPEX_HAVE_LM_SENSORS) 39 | message(STATUS "Found LM_SENSORS: ${LM_SENSORS_LIBRARY}") 40 | endif () 41 | 42 | -------------------------------------------------------------------------------- /cmake/Modules/FindMSR.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libmsr 2 | # Once done this will define 3 | # MSR_FOUND - System has MSR 4 | # MSR_INCLUDE_DIRS - The MSR include directories 5 | # MSR_LIBRARIES - The libraries needed to use MSR 6 | # MSR_DEFINITIONS - Compiler switches required for using MSR 7 | 8 | find_package(PkgConfig) 9 | 10 | if(NOT MSR_ROOT AND NOT $ENV{MSR_ROOT} STREQUAL "") 11 | set(MSR_ROOT $ENV{MSR_ROOT}) 12 | endif() 13 | 14 | message(INFO " will check ${MSR_ROOT} for MSR") 15 | 16 | pkg_check_modules(PC_MSR QUIET MSR) 17 | set(MSR_DEFINITIONS ${PC_MSR_CFLAGS_OTHER}) 18 | 19 | find_path(MSR_INCLUDE_DIR msr/msr_core.h 20 | HINTS ${PC_MSR_INCLUDEDIR} ${PC_MSR_INCLUDE_DIRS} ${MSR_ROOT}/include) 21 | 22 | find_library(MSR_LIBRARY NAMES msr 23 | HINTS ${PC_MSR_LIBDIR} ${PC_MSR_LIBRARY_DIRS} ${MSR_ROOT}/lib 24 | ${MSR_ROOT}/lib/* NO_DEFAULT_PATH) 25 | 26 | include(FindPackageHandleStandardArgs) 27 | # handle the QUIETLY and REQUIRED arguments and set MSR_FOUND to TRUE 28 | # if all listed variables are TRUE 29 | find_package_handle_standard_args(MSR DEFAULT_MSG 30 | MSR_LIBRARY MSR_INCLUDE_DIR) 31 | 32 | mark_as_advanced(MSR_INCLUDE_DIR MSR_LIBRARY) 33 | 34 | if(MSR_FOUND) 35 | set(MSR_LIBRARIES ${MSR_LIBRARY} ) 36 | set(MSR_INCLUDE_DIRS ${MSR_INCLUDE_DIR} ) 37 | set(MSR_DIR ${MSR_ROOT}) 38 | add_definitions(-DAPEX_HAVE_MSR) 39 | endif() 40 | 41 | -------------------------------------------------------------------------------- /cmake/Modules/FindOpenACCProfiling.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibOpenACCProfiling 2 | # Once done this will define 3 | # OpenACCProfiling_FOUND - System has OpenACCProfiling 4 | 5 | find_package(PkgConfig) 6 | 7 | # check if the compiler has built-in support for OpenACC profiling 8 | INCLUDE(CheckCCompilerFlag) 9 | CHECK_C_COMPILER_FLAG(-fopenmp HAVE_OPENMP) 10 | try_compile(APEX_HAVE_OpenACCProfiling_NATIVE ${CMAKE_CURRENT_BINARY_DIR}/openacc_test 11 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/openacc_test openacc_test openacc_test 12 | CMAKE_FLAGS -DCMAKE_CXX_FLAGS:STRING="${OpenACC_CXX_FLAGS}" 13 | -DCMAKE_CMAKE_EXE_LINKER_FLAGS:STRING="${OpenACC_CXX_FLAGS}") 14 | 15 | if(APEX_HAVE_OpenACCProfiling_NATIVE) 16 | set(OpenACCProfiling_FOUND TRUE) 17 | message("Detected compiler has OpenACC Profiling support.") 18 | else() 19 | message("Detected compiler does not have OpenACC Profiling support.") 20 | endif() 21 | 22 | -------------------------------------------------------------------------------- /cmake/Modules/FindPAPI.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibPAPI 2 | # Once done this will define 3 | # PAPI_FOUND - System has PAPI 4 | # PAPI_INCLUDE_DIRS - The PAPI include directories 5 | # PAPI_LIBRARIES - The libraries needed to use PAPI 6 | # PAPI_DEFINITIONS - Compiler switches required for using PAPI 7 | 8 | if(NOT DEFINED $PAPI_ROOT) 9 | if(DEFINED ENV{PAPI_ROOT}) 10 | # message(" env PAPI_ROOT is defined as $ENV{PAPI_ROOT}") 11 | set(PAPI_ROOT $ENV{PAPI_ROOT}) 12 | endif() 13 | endif() 14 | 15 | find_path(PAPI_INCLUDE_DIR NAMES papi.h 16 | HINTS ${PAPI_ROOT}/include $ENV{PAPI_ROOT}/include) 17 | 18 | if(APPLE) 19 | find_library(PAPI_LIBRARY NAMES libpapi.a papi 20 | HINTS ${PAPI_ROOT}/* $ENV{PAPI_ROOT}/*) 21 | else() 22 | find_library(PAPI_LIBRARY NAMES papi 23 | HINTS ${PAPI_ROOT}/* $ENV{PAPI_ROOT}/*) 24 | endif(APPLE) 25 | 26 | include(FindPackageHandleStandardArgs) 27 | # handle the QUIETLY and REQUIRED arguments and set PAPI_FOUND to TRUE 28 | # if all listed variables are TRUE 29 | find_package_handle_standard_args(PAPI DEFAULT_MSG 30 | PAPI_LIBRARY PAPI_INCLUDE_DIR) 31 | 32 | mark_as_advanced(PAPI_INCLUDE_DIR PAPI_LIBRARY) 33 | 34 | if(PAPI_FOUND) 35 | set(PAPI_LIBRARIES ${PAPI_LIBRARY} ) 36 | set(PAPI_INCLUDE_DIRS ${PAPI_INCLUDE_DIR}) 37 | set(PAPI_DIR ${PAPI_ROOT}) 38 | add_definitions(-DAPEX_HAVE_PAPI) 39 | endif() 40 | 41 | -------------------------------------------------------------------------------- /cmake/Modules/FindPHIPROF.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find PhiProf 2 | # Once done this will define 3 | # PHIPROF_FOUND - System has PhiProf 4 | # PHIPROF_INCLUDE_DIRS - The include directories 5 | 6 | 7 | find_package(PkgConfig) 8 | 9 | if(NOT DEFINED $PHIPROF_ROOT) 10 | if(DEFINED ENV{PHIPROF_ROOT}) 11 | # message(" env PHIPROF_ROOT is defined as $ENV{PHIPROF_ROOT}") 12 | set(PHIPROF_ROOT $ENV{PHIPROF_ROOT}) 13 | endif() 14 | endif() 15 | 16 | if(NOT DEFINED $PHIPROF_ROOT) 17 | if(DEFINED PHIPROF_DIR) 18 | # message(" env PHIPROF_ROOT is defined as $ENV{PHIPROF_ROOT}") 19 | set(PHIPROF_ROOT $PHIPROF_DIR) 20 | endif() 21 | endif() 22 | 23 | message(INFO " will check ${PHIPROF_ROOT} for PHIPROF") 24 | set(CMAKE_PREFIX_PATH} "${CMAKE_PREFIX_PATH} ${PHIPROF_ROOT}") 25 | #set(ENV{PKG_CONFIG_PATH} "${PHIPROF_ROOT}/libs/pkgconfig") 26 | 27 | if(NOT PHIPROF_FOUND) 28 | find_path(PHIPROF_INCLUDE_DIR NAMES phiprof.hpp 29 | HINTS ${PHIPROF_ROOT}/include) 30 | 31 | include(FindPackageHandleStandardArgs) 32 | # handle the QUIETLY and REQUIRED arguments and set PHIPROF_FOUND to TRUE 33 | # if all listed variables are TRUE 34 | find_package_handle_standard_args(PHIPROF DEFAULT_MSG 35 | PHIPROF_INCLUDE_DIR) 36 | 37 | mark_as_advanced(PHIPROF_INCLUDE_DIR) 38 | message( "Using ${PHIPROF_INCLUDE_DIR} as PhiProf include dir" ) 39 | 40 | if(PHIPROF_FOUND) 41 | set(PHIPROF_INCLUDE_DIRS ${PHIPROF_INCLUDE_DIR}) 42 | set(PHIPROF_DIR ${PHIPROF_ROOT}) 43 | add_definitions(-DAPEX_HAVE_PHIPROF) 44 | endif() 45 | endif() 46 | 47 | -------------------------------------------------------------------------------- /cmake/Modules/FindROCTX.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibROCTX 2 | # Once done this will define 3 | # ROCTX_FOUND - System has ROCTX 4 | # ROCTX_INCLUDE_DIRS - The ROCTX include directories 5 | # ROCTX_LIBRARIES - The libraries needed to use ROCTX 6 | # ROCTX_DEFINITIONS - Compiler switches required for using ROCTX 7 | 8 | if(NOT DEFINED $ROCTX_ROOT) 9 | if(DEFINED ENV{ROCTX_ROOT}) 10 | # message(" env ROCTX_ROOT is defined as $ENV{ROCTX_ROOT}") 11 | set(ROCTX_ROOT $ENV{ROCTX_ROOT}) 12 | endif() 13 | if(DEFINED $ROCTX_PATH) 14 | set(ROCTX_ROOT ${ROCTX_PATH}) 15 | endif() 16 | endif() 17 | 18 | find_path(ROCTX_INCLUDE_DIR NAMES roctx.h 19 | HINTS ${ROCM_ROOT}/include/roctracer ${ROCTX_ROOT}/include) 20 | 21 | find_library(ROCTX_LIBRARY NAMES roctx64 22 | HINTS ${ROCM_ROOT}/roctracer/lib64 ${ROCM_ROOT}/roctracer/lib ${ROCTX_ROOT}/lib64 ${ROCTX_ROOT}/lib) 23 | 24 | include(FindPackageHandleStandardArgs) 25 | # handle the QUIETLY and REQUIRED arguments and set ROCTX_FOUND to TRUE 26 | # if all listed variables are TRUE 27 | find_package_handle_standard_args(ROCTX DEFAULT_MSG 28 | ROCTX_LIBRARY ROCTX_INCLUDE_DIR) 29 | 30 | mark_as_advanced(ROCTX_INCLUDE_DIR ROCTX_LIBRARY) 31 | 32 | if(ROCTX_FOUND) 33 | set(ROCTX_LIBRARIES ${CUDA_LIBRARY} ${ROCTX_LIBRARY} ) 34 | set(ROCTX_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIRS} ${ROCTX_INCLUDE_DIR}) 35 | set(ROCTX_DIR ${ROCTX_ROOT}) 36 | add_definitions(-DAPEX_HAVE_ROCTX) 37 | endif() 38 | 39 | -------------------------------------------------------------------------------- /cmake/Modules/FindRSMI.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LibRSMI 2 | # Once done this will define 3 | # RSMI_FOUND - System has RSMI 4 | # RSMI_INCLUDE_DIRS - The RSMI include directories 5 | # RSMI_LIBRARIES - The libraries needed to use RSMI 6 | # RSMI_DEFINITIONS - Compiler switches required for using RSMI 7 | 8 | if(NOT DEFINED $RSMI_ROOT) 9 | if(DEFINED ENV{RSMI_ROOT}) 10 | # message(" env RSMI_ROOT is defined as $ENV{RSMI_ROOT}") 11 | set(RSMI_ROOT $ENV{RSMI_ROOT}) 12 | endif() 13 | endif() 14 | 15 | if(NOT DEFINED $RSMI_ROOT AND ROCM_PATH) 16 | message(INFO " env RSMI_ROOT is assuming ${ROCM_PATH}/rocm_smi") 17 | set(RSMI_ROOT "${ROCM_PATH}/rocm_smi") 18 | endif() 19 | 20 | find_path(RSMI_INCLUDE_DIR NAMES rocm_smi/rocm_smi.h 21 | HINTS ${RSMI_ROOT}/include ${ROCM_ROOT}/rocm_smi/include) 22 | 23 | find_library(RSMI_LIBRARY NAMES rocm_smi64 24 | HINTS ${RSMI_ROOT} ${RSMI_ROOT}/lib64 ${RSMI_ROOT}/lib ${ROCM_ROOT}/rocm_smi/lib64 ${ROCM_ROOT}/rocm_smi/lib) 25 | 26 | include(FindPackageHandleStandardArgs) 27 | # handle the QUIETLY and REQUIRED arguments and set RSMI_FOUND to TRUE 28 | # if all listed variables are TRUE 29 | find_package_handle_standard_args(RSMI DEFAULT_MSG 30 | RSMI_LIBRARY RSMI_INCLUDE_DIR) 31 | 32 | mark_as_advanced(RSMI_INCLUDE_DIR RSMI_LIBRARY) 33 | 34 | if(RSMI_FOUND) 35 | set(RSMI_LIBRARIES ${RSMI_LIBRARY} ) 36 | set(RSMI_INCLUDE_DIRS ${RSMI_INCLUDE_DIR}) 37 | set(RSMI_DIR ${RSMI_ROOT}) 38 | add_definitions(-DAPEX_HAVE_RSMI) 39 | endif() 40 | 41 | -------------------------------------------------------------------------------- /cmake/Modules/ProcessorCount.cmake: -------------------------------------------------------------------------------- 1 | if(NOT DEFINED PROCESSOR_COUNT) 2 | # Unknown: 3 | set(PROCESSOR_COUNT 1) 4 | 5 | # Linux: 6 | set(cpuinfo_file "/proc/cpuinfo") 7 | if(EXISTS "${cpuinfo_file}") 8 | file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") 9 | list(LENGTH procs PROCESSOR_COUNT) 10 | endif() 11 | 12 | # Mac: 13 | if(APPLE) 14 | find_program(cmd_sys_pro "sysctl") 15 | if(cmd_sys_pro) 16 | execute_process(COMMAND ${cmd_sys_pro} -n hw.ncpu OUTPUT_VARIABLE 17 | PROCESSOR_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE) 18 | endif() 19 | endif() 20 | 21 | # Windows: 22 | if(WIN32) 23 | set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}") 24 | endif() 25 | endif() 26 | 27 | if (DEFINED PROCESSOR_COUNT) 28 | message(INFO " Found ${PROCESSOR_COUNT} cores.") 29 | if (PROCESSOR_COUNT GREATER 16) 30 | set(PROCESSOR_COUNT 16) 31 | endif (PROCESSOR_COUNT GREATER 16) 32 | message(INFO " Using ${PROCESSOR_COUNT} cores.") 33 | endif(DEFINED PROCESSOR_COUNT) 34 | -------------------------------------------------------------------------------- /cmake/Modules/intel_mic_toolchain.cmake: -------------------------------------------------------------------------------- 1 | SET(CMAKE_SYSTEM_NAME Linux) 2 | SET(CMAKE_SYSTEM_PROCESSOR k1om) 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | 5 | # specify the cross compiler 6 | SET(CMAKE_C_COMPILER icc) 7 | SET(CMAKE_CXX_COMPILER icpc) 8 | SET(MPI_C_COMPILER mpiicc) 9 | SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-k1om-linux-) 10 | 11 | # where is the target environment 12 | SET(CMAKE_FIND_ROOT_PATH /usr/linux-k1om-4.7) 13 | 14 | # set a variable for us to use 15 | SET(APEX_INTEL_MIC ON CACHE INTERNAL "Cross-compiling for Intel Phi Architecture" FORCE) 16 | -------------------------------------------------------------------------------- /cmake/Modules/otf2_collective_callbacks.patch: -------------------------------------------------------------------------------- 1 | --- a/src/otf2_archive_int.c 2 | +++ b/src/otf2_archive_int.c 3 | @@ -1083,7 +1083,7 @@ otf2_archive_set_collective_callbacks( OTF2_Archive* archive, 4 | archive->global_comm_context = globalCommContext; 5 | archive->local_comm_context = localCommContext; 6 | 7 | - OTF2_ErrorCode status; 8 | + OTF2_ErrorCode status = OTF2_SUCCESS; 9 | 10 | /* It is time to create the directories by the root rank. */ 11 | if ( archive->file_mode == OTF2_FILEMODE_WRITE ) 12 | -------------------------------------------------------------------------------- /cmake/tests/gcc_version.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) 2011 Bryce Lelbach 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | //////////////////////////////////////////////////////////////////////////////// 7 | 8 | #include 9 | #include "stdio.h" 10 | 11 | int main() 12 | { 13 | char tmp[32]; 14 | sprintf(tmp, "%02d%02d%02d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); 15 | std::cout << tmp; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /cmake/tests/ompt_5.0_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.20.1 FATAL_ERROR) 2 | project(ompt_5.0_test) 3 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 4 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") 5 | add_executable(ompt_5.0_test ompt_test.cpp) -------------------------------------------------------------------------------- /cmake/tests/ompt_5.1_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.20.1 FATAL_ERROR) 2 | project(ompt_5.1_test) 3 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 4 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") 5 | add_executable(ompt_5.1_test ompt_test.cpp) -------------------------------------------------------------------------------- /cmake/tests/openacc_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.20.1 FATAL_ERROR) 2 | project(openacc_test) 3 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenACC_CXX_FLAGS}") 4 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenACC_CXX_FLAGS}") 5 | add_executable(openacc_test openacc_test.cpp) -------------------------------------------------------------------------------- /cmake/tests/openacc_test/openacc_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include 10 | #include 11 | #include "apex_openacc.hpp" 12 | 13 | /* Function called by OpenACC runtime to register callbacks */ 14 | extern "C" { 15 | 16 | void acc_register_library(acc_prof_reg reg, 17 | acc_prof_reg unreg, APEX_OPENACC_LOOKUP_FUNC lookup) { 18 | DEBUG_PRINT("Inside acc_register_library\n"); 19 | APEX_UNUSED(unreg); 20 | APEX_UNUSED(lookup); 21 | 22 | } // acc_register_library 23 | 24 | void apex_openacc_launch_callback(acc_prof_info* prof_info, 25 | acc_event_info* event_info, acc_api_info* api_info) { 26 | } 27 | 28 | void apex_openacc_other_callback( acc_prof_info* prof_info, 29 | acc_event_info* event_info, acc_api_info* api_info ) { 30 | } 31 | 32 | void apex_openacc_data_callback(acc_prof_info* prof_info, 33 | acc_event_info* event_info, acc_api_info* api_info ) { 34 | } 35 | 36 | 37 | } // extern "C" 38 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # add a target to generate API documentation with Doxygen 2 | find_package(Doxygen) 3 | find_package(LATEX COMPONENTS PDFLATEX MAKEINDEX) 4 | 5 | add_custom_target(doc) 6 | 7 | if(DOXYGEN_FOUND) 8 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) 9 | add_custom_target(htmldoc ${DOXYGEN_EXECUTABLE} 10 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY 11 | ${CMAKE_CURRENT_BINARY_DIR} 12 | COMMENT "Generating API documentation with Doxygen" VERBATIM) 13 | add_dependencies(doc htmldoc) 14 | INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION doc 15 | OPTIONAL) 16 | if(DEFINED PDFLATEX_COMPILER) 17 | MESSAGE(STATUS "Enabled: building PDF reference manual") 18 | add_custom_command( 19 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf 20 | COMMAND ${CMAKE_MAKE_PROGRAM} 21 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex 22 | ${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile 23 | COMMENT "Creating PDF of documentation" 24 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex 25 | ) 26 | add_custom_target(refman.pdf 27 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf 28 | COMMENT "Executing ${PDFLATEX_COMPILER}" 29 | ) 30 | #add_dependencies(doc refman.pdf) 31 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf DESTINATION 32 | doc OPTIONAL) 33 | endif() 34 | else() 35 | MESSAGE(STATUS "Doxygen not found. Building documentation requires Doxygen.") 36 | endif(DOXYGEN_FOUND) 37 | 38 | -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | To build the documentation, type "make doc" in your CMake build directory. 2 | -------------------------------------------------------------------------------- /doc/logo-cropped.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/logo-cropped.pdf -------------------------------------------------------------------------------- /doc/logo-cropped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/logo-cropped.png -------------------------------------------------------------------------------- /doc/logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/logo.pdf -------------------------------------------------------------------------------- /doc/logo.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/logo.pptx -------------------------------------------------------------------------------- /doc/webdocs/README.md: -------------------------------------------------------------------------------- 1 | To deploy the documentation to github, run this command: 2 | 3 | mkdocs gh-deploy --clean 4 | -------------------------------------------------------------------------------- /doc/webdocs/docs/custom.css: -------------------------------------------------------------------------------- 1 | .header-image #title a { 2 | background: url( 'img/logo-cropped.pdf' ) no-repeat; 3 | } -------------------------------------------------------------------------------- /doc/webdocs/docs/examples.md: -------------------------------------------------------------------------------- 1 | # HPX-3 and 1D stencil 2 | 3 | *...coming soon...* 4 | 5 | # HPX-5 and LULESH 6 | 7 | *...coming soon...* 8 | 9 | # HPX-5 and SSSP 10 | 11 | *...coming soon...* 12 | 13 | # HPX-5 and MiniGhost 14 | 15 | *...coming soon...* 16 | 17 | # OpenMP and LULESH 2.0 18 | 19 | *...coming soon...* 20 | 21 | # OpenMP and NPB 3.2.1 22 | 23 | *...coming soon...* 24 | 25 | # MPI applications 26 | 27 | *...coming soon...* 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/webdocs/docs/img/APEX_arch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/APEX_arch.pdf -------------------------------------------------------------------------------- /doc/webdocs/docs/img/APEX_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/APEX_arch.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/APEX_diagram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/APEX_diagram.pdf -------------------------------------------------------------------------------- /doc/webdocs/docs/img/APEX_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/APEX_diagram.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/cuda_taskgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/cuda_taskgraph.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/fibonacci_scatterplot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/fibonacci_scatterplot.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/jumpshot1.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/jumpshot1.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/jumpshot2.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/jumpshot2.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/logo-cropped.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/logo-cropped.pdf -------------------------------------------------------------------------------- /doc/webdocs/docs/img/logo-cropped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/logo-cropped.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/lulesh-paraprof1.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/lulesh-paraprof1.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/lulesh-paraprof2.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/lulesh-paraprof2.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/lulesh-paraprof3.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/lulesh-paraprof3.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/openacc_taskgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/openacc_taskgraph.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/openmp_taskgraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/openmp_taskgraph.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/paraprof1.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/paraprof1.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/paraprof2.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/paraprof2.tiff -------------------------------------------------------------------------------- /doc/webdocs/docs/img/pi_cu_gte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/pi_cu_gte.png -------------------------------------------------------------------------------- /doc/webdocs/docs/img/pi_cu_trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UO-OACISS/apex/06cf1ff3d3eadb614a8170c31184f98e397bb67a/doc/webdocs/docs/img/pi_cu_trace.png -------------------------------------------------------------------------------- /doc/webdocs/docs/refman.md: -------------------------------------------------------------------------------- 1 | # API Doxygen Reference 2 | 3 | The source code is instrumented with Doxygen comments, and the API reference 4 | manual can be generated by executing 'make doc' in the build directory, after 5 | CMake configuration. A fairly recent version of the API reference 6 | documentation is available here: 7 | 8 | 9 | 10 | In the event that the [API specification](spec.md) and the reference implementation 11 | (as generated by the Doxygen comments from the actual source code) do 12 | not match, assume that the specification is correct and that the implementation 13 | is non-compliant - and subsequently contact the project maintainers so that 14 | we may bring the implementation into compliance. 15 | -------------------------------------------------------------------------------- /doc/webdocs/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: APEX 2 | site_url: http://UO-OACISS.github.io/apex 3 | repo_url: http://github.com/UO-OACISS/apex 4 | repo_name: GitHub 5 | site_description: APEX - Autonomic Performance Environment for eXascale v2.6.4 6 | site_author: Kevin Huck (khuck@cs.uoregon.edu) 7 | copyright: (C) 2014-2024 University of Oregon, All Rights Reserved 8 | nav: 9 | - Home: index.md 10 | - Quick Start (HPX): quickstarthpx.md 11 | - Quick Start (standalone): quickstart.md 12 | - Feature Overview: feature.md 13 | - Installation: install.md 14 | - Usage: usage.md 15 | # - Use Cases: usecases.md 16 | - Useful Environment Variables: environment.md 17 | # - Research Examples: examples.md 18 | - API Specification : spec.md 19 | - API Doxygen Reference : refman.md 20 | theme: readthedocs 21 | markdown_extensions: 22 | - fenced_code 23 | - toc: 24 | permalink: True 25 | separator: "_" 26 | 27 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah-ompt-papi-mpi-otf.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=1 6 | export APEX_OTF2_TESTING=1 7 | export APEX_OTF2_COLLECTIVE_SIZE=1 8 | export APEX_POLICY=1 9 | export APEX_MEASURE_CONCURRENCY=1 10 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 11 | export APEX_SCREEN_OUTPUT=1 12 | export APEX_PROFILE_OUTPUT=1 13 | export APEX_CSV_OUTPUT=1 14 | export APEX_TASKGRAPH_OUTPUT=1 15 | export APEX_PROC_CPUINFO=1 16 | export APEX_PROC_MEMINFO=1 17 | export APEX_PROC_NET_DEV=1 18 | export APEX_PROC_SELF_STATUS=1 19 | export APEX_PROC_SELF_IO=1 20 | export APEX_PROC_STAT=1 21 | export APEX_THROTTLE_CONCURRENCY=1 22 | export APEX_THROTTLING_MAX_THREADS=8 23 | export APEX_THROTTLING_MIN_THREADS=1 24 | export APEX_THROTTLE_ENERGY=1 25 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 26 | export APEX_THROTTLING_MAX_WATTS=300 27 | export APEX_THROTTLING_MIN_WATTS=150 28 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 29 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 30 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 31 | export APEX_PIN_APEX_THREADS=1 32 | export APEX_TASK_SCATTERPLOT=1 33 | export APEX_PAPI_METRICS= 34 | export APEX_PLUGINS= 35 | export APEX_PLUGINS_PATH=./ 36 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 37 | export APEX_OTF2_ARCHIVE_NAME=APEX 38 | export APEX_POLICY_DRAIN_TIMEOUT=100000 39 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah-ompt-papi-mpi-tau.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=1 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=1 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=1 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah-ompt-papi-mpi.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=1 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=1 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah-ompt-papi.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=1 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=1 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS="PAPI_TOT_INS PAPI_TOT_CYC PAPI_L1_TCM" 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah-ompt.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=1 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=1 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=1 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-ah.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=1 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=1 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-base.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=1 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=1 11 | export APEX_PROFILE_OUTPUT=1 12 | export APEX_CSV_OUTPUT=1 13 | export APEX_TASKGRAPH_OUTPUT=1 14 | export APEX_PROC_CPUINFO=1 15 | export APEX_PROC_MEMINFO=1 16 | export APEX_PROC_NET_DEV=1 17 | export APEX_PROC_SELF_STATUS=1 18 | export APEX_PROC_SELF_IO=1 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=0 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=0 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=1 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/apex-defaults.conf: -------------------------------------------------------------------------------- 1 | export APEX_DISABLE=0 2 | export APEX_SUSPEND=0 3 | export APEX_PAPI_SUSPEND=0 4 | export APEX_TAU=0 5 | export APEX_OTF2=0 6 | export APEX_OTF2_COLLECTIVE_SIZE=1 7 | export APEX_POLICY=1 8 | export APEX_MEASURE_CONCURRENCY=0 9 | export APEX_MEASURE_CONCURRENCY_PERIOD=1000000 10 | export APEX_SCREEN_OUTPUT=0 11 | export APEX_PROFILE_OUTPUT=0 12 | export APEX_CSV_OUTPUT=0 13 | export APEX_TASKGRAPH_OUTPUT=0 14 | export APEX_PROC_CPUINFO=0 15 | export APEX_PROC_MEMINFO=0 16 | export APEX_PROC_NET_DEV=0 17 | export APEX_PROC_SELF_STATUS=0 18 | export APEX_PROC_SELF_IO=0 19 | export APEX_PROC_STAT=1 20 | export APEX_THROTTLE_CONCURRENCY=0 21 | export APEX_THROTTLING_MAX_THREADS=8 22 | export APEX_THROTTLING_MIN_THREADS=1 23 | export APEX_THROTTLE_ENERGY=0 24 | export APEX_THROTTLE_ENERGY_PERIOD=1000000 25 | export APEX_THROTTLING_MAX_WATTS=300 26 | export APEX_THROTTLING_MIN_WATTS=150 27 | export APEX_PTHREAD_WRAPPER_STACK_SIZE=2097152 28 | export APEX_OMPT_REQUIRED_EVENTS_ONLY=0 29 | export APEX_OMPT_HIGH_OVERHEAD_EVENTS=0 30 | export APEX_PIN_APEX_THREADS=1 31 | export APEX_TASK_SCATTERPLOT=0 32 | export APEX_PAPI_METRICS= 33 | export APEX_PLUGINS= 34 | export APEX_PLUGINS_PATH=./ 35 | export APEX_OTF2_ARCHIVE_PATH=OTF2_archive 36 | export APEX_OTF2_ARCHIVE_NAME=APEX 37 | export APEX_POLICY_DRAIN_TIMEOUT=100000 38 | -------------------------------------------------------------------------------- /etc/configuration-files/i386-kevinmacbookair.local-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=$HOME/install/jemalloc-3.5.1" 2 | #platform_malloc="-DGPERFTOOLS_ROOT=/usr/local/gperftools/2.5" 3 | #platform_malloc="-DAPEX_WITH_JEMALLOC=TRUE" 4 | platform_bfd="-DAPEX_WITH_BFD=FALSE" 5 | platform_ah="-DAPEX_BUILD_ACTIVEHARMONY=TRUE" 6 | platform_otf="-DAPEX_BUILD_OTF2=TRUE" 7 | platform_ompt="-DAPEX_BUILD_OMPT=TRUE -DAPEX_WITH_PLUGINS=TRUE" 8 | platform_mpi="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DAPEX_WITH_MPI=TRUE" 9 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=$HOME/install/papi-5.3.0" 10 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=apple -DTAU_OPTIONS=-pthread" 11 | 12 | parallel_build="-j 8" 13 | -------------------------------------------------------------------------------- /etc/configuration-files/ppc64le-minotaur-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=$HOME/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=/usr/local/packages/gperftools/2.5" 3 | platform_bfd="-DBFD_ROOT=/usr/local/packages/binutils/2.25" 4 | platform_ah="-DACTIVEHARMONY_ROOT=/usr/local/packages/activeharmony/4.6.0-ppc64le" 5 | platform_ompt="-DOMPT_ROOT=/usr/local/packages/LLVM-ompt/power8_gcc-4.9.2 -DAPEX_WITH_PLUGINS=TRUE" 6 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=/usr/local/packages/papi/5.5.0-ppc64le" 7 | #platform_mpi="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DAPEX_WITH_MPI=TRUE" 8 | platform_mpi="-DAPEX_WITH_MPI=FALSE" 9 | platform_otf="-DOTF2_ROOT=/usr/local/packages/otf2/2.0-ppc64le" 10 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=ibm64linux -DTAU_OPTIONS=-pthread" 11 | 12 | module load gcc/5.3 13 | 14 | parallel_build="-j 20" 15 | -------------------------------------------------------------------------------- /etc/configuration-files/x86_64-delphi-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=$HOME/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=/usr/local/packages/gperftools/2.5" 3 | #platform_malloc="-DJEMALLOC_ROOT=/usr/local/packages/jemalloc/4.2.1" 4 | platform_bfd="-DBFD_ROOT=$HOME/src/tau2/x86_64/binutils-2.23.2" 5 | platform_ah="-DACTIVEHARMONY_ROOT=$HOME/install/activeharmony/4.6.0" 6 | platform_otf="-DOTF2_ROOT=/usr/local/packages/otf2/2.0-x86_64" 7 | platform_ompt="-DOMPT_ROOT=$HOME/src/LLVM-openmp/build-gcc-Release -DAPEX_WITH_PLUGINS=TRUE" 8 | platform_mpi="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DAPEX_WITH_MPI=TRUE" 9 | #platform_mpi="" 10 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=${PAPI}" 11 | #platform_papi="" 12 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread" 13 | 14 | module purge 15 | module load cmake mpi-tor/openmpi-1.8_gcc-4.9 papi 16 | module load gcc/5.3 17 | #module swap gcc gcc/5.3 18 | 19 | parallel_build="-j 36" 20 | -------------------------------------------------------------------------------- /etc/configuration-files/x86_64-godzilla-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=$HOME/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=/usr/local/packages/gperftools/2.5" 3 | #platform_malloc="-DJEMALLOC_ROOT=/usr/local/packages/jemalloc/4.2.1" 4 | platform_bfd="-DBFD_ROOT=$HOME/src/tau2/x86_64/binutils-2.23.2" 5 | platform_ah="-DACTIVEHARMONY_ROOT=$HOME/install/activeharmony/4.6.0" 6 | platform_otf="-DOTF2_ROOT=/usr/local/packages/otf2/2.0-x86_64" 7 | platform_ompt="-DOMPT_ROOT=$HOME/src/LLVM-openmp/build-gcc-Release -DAPEX_WITH_PLUGINS=TRUE" 8 | platform_mpi="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DAPEX_WITH_MPI=TRUE" 9 | #platform_mpi="" 10 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=${PAPI}" 11 | #platform_papi="" 12 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread" 13 | 14 | module purge 15 | module load cmake mpi-tor/openmpi-1.8_gcc-4.9 papi 16 | module load gcc/5.3 17 | #module swap gcc gcc/5.3 18 | 19 | parallel_build="-j 24" 20 | -------------------------------------------------------------------------------- /etc/configuration-files/x86_64-grover-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=${HOME}/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=${HOME}/install/gperftools/2.5" 3 | platform_bfd="-DBFD_ROOT=${HOME}/install/binutils-2.25-knl" 4 | platform_ah="-DACTIVEHARMONY_ROOT=${HOME}/install/activeharmony/4.6.0-knl" 5 | platform_otf="-DOTF2_ROOT=${HOME}/install/otf2/2.0-knl" 6 | platform_ompt="-DOMPT_ROOT=${HOME}/src/LLVM-openmp/build-icc-Release -DAPEX_WITH_PLUGINS=TRUE" 7 | platform_mpi="" 8 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=${HOME}/install/papi/5.5.0-knl" 9 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread" 10 | 11 | module load cmake intel gcc/5.3 12 | 13 | parallel_build="-j 32" 14 | -------------------------------------------------------------------------------- /etc/configuration-files/x86_64-grover-icc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=${HOME}/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=${HOME}/install/gperftools/2.5" 3 | platform_bfd="-DBFD_ROOT=${HOME}/install/binutils-2.25-knl" 4 | platform_ah="-DACTIVEHARMONY_ROOT=${HOME}/install/activeharmony/4.6.0-knl" 5 | platform_otf="-DOTF2_ROOT=${HOME}/install/otf2/2.0-knl" 6 | platform_ompt="-DOMPT_ROOT=${HOME}/src/LLVM-openmp/build-icc-Release -DAPEX_WITH_PLUGINS=TRUE" 7 | platform_mpi="" 8 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=${HOME}/install/papi/5.5.0-knl" 9 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=$HOME/src/tau2 -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-icpc-pthread" 10 | 11 | module load cmake intel gcc/5.3 12 | 13 | parallel_build="-j 32" 14 | -------------------------------------------------------------------------------- /etc/configuration-files/x86_64-ktau-gcc.sh: -------------------------------------------------------------------------------- 1 | #platform_malloc="-DJEMALLOC_ROOT=$HOME/install/jemalloc-3.5.1" 2 | platform_malloc="-DGPERFTOOLS_ROOT=/usr/local/gperftools/2.5" 3 | #platform_malloc="-DAPEX_WITH_JEMALLOC=TRUE" 4 | platform_bfd="-DAPEX_WITH_BFD=TRUE" 5 | platform_ah="-DACTIVEHARMONY_ROOT=/usr/local/activeharmony/4.6" 6 | #platform_otf="-DOTF2_ROOT=/usr/local/otf2/2.0" 7 | platform_otf="-DOTF2_ROOT=/usr/local/otf2/2.1-debug" 8 | #platform_ompt="-DOMPT_ROOT=/usr/local/LLVM-ompt/Release" 9 | platform_ompt="-DOMPT_ROOT=$HOME/src/LLVM-openmp/build-gcc-Release -DAPEX_WITH_PLUGINS=TRUE" 10 | platform_mpi="-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DAPEX_WITH_MPI=TRUE" 11 | platform_papi="-DAPEX_WITH_PAPI=TRUE -DPAPI_ROOT=/usr/local/papi/5.5.0" 12 | platform_tau="-DAPEX_WITH_TAU=TRUE -DTAU_ROOT=/usr/local/tau/git -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread" 13 | 14 | parallel_build="-j 8" 15 | -------------------------------------------------------------------------------- /etc/job.pbs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | 4 | cd /opt/tau/hpx.apex.tau/bin 5 | pbsdsh -v -u /opt/tau/hpx.apex.tau/bin/runme.sh \ 6 | /opt/tau/hpx.apex.tau/bin/gtcx_client -t 12 \ 7 | --hpx:print-counter '/threadqueue{locality#*/worker-thread#*}/length' \ 8 | --hpx:print-counter-interval=4000 \ 9 | --hpx:nodes=`cat $PBS_NODEFILE` 10 | 11 | 12 | -------------------------------------------------------------------------------- /etc/make-archive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | archive=apex.tar.gz 4 | rm -f $archive 5 | git archive origin/master --prefix apex/ | gzip > $archive 6 | tar -tvf $archive -------------------------------------------------------------------------------- /etc/maketag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | git checkout master 4 | git merge develop 5 | 6 | if [ -z ${oldtag+x} ]; then 7 | echo "oldtag is unset"; 8 | kill -INT $$ 9 | else 10 | echo "oldtag is set to '$oldtag'"; 11 | fi 12 | if [ -z ${tagname+x} ]; then 13 | echo "tagname is unset"; 14 | kill -INT $$ 15 | else 16 | echo "tagname is set to '$tagname'"; 17 | fi 18 | 19 | echo "Commit Log:" >> ${tagname}.txt 20 | 21 | git log ${oldtag}..HEAD --pretty=format:'
  • view commit • %s
  • ' --reverse > ${tagname}.txt 22 | # git log ${oldtag}..HEAD --pretty=format:'http://github.com/khuck/xpress-apex/commit/%H %ad %s ' --reverse >> ${tagname}.txt 23 | -------------------------------------------------------------------------------- /etc/pr_upstream.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | # update all remotes 4 | git fetch origin 5 | git fetch github 6 | 7 | # checkout origin/develop from git.nic.uoregon.edu 8 | git checkout develop 9 | 10 | # merge the github PR request changes 11 | git merge github/develop 12 | 13 | # push to origin 14 | git push origin develop 15 | -------------------------------------------------------------------------------- /etc/runme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script is executed by the bash shell which will initialize all 3 | # environment variables as usual. 4 | 5 | export TAU_ROOT=/opt/tau/tau2 6 | export PATH=$TAU_ROOT/x86_64/bin:$PATH 7 | cd /opt/tau/hpx.apex.tau/bin 8 | 9 | rm -f profile.* 10 | 11 | tau_exec -T pdt,pthread,serial $* 12 | -------------------------------------------------------------------------------- /pkgconfig/apex.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | extralibs=@extralibs@ 6 | extralibs_rpath=@extralibs_rpath@ 7 | extraincludes=@extraincludes@ 8 | 9 | Name: APEX 10 | Description: Autonomic Performance Environment for eXascale (XPRESS) 11 | Requires: 12 | Version: @PACKAGE_VERSION@ 13 | Libs: -L${libdir} -lapex ${extralibs} -Wl,-rpath,${libdir} ${extralibs_rpath} -lstdc++ 14 | Cflags: -I${includedir} -DHAVE_APEX ${extraincludes} 15 | 16 | -------------------------------------------------------------------------------- /src/ITTNotify/CMakeLists.standalone: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2018 Kevin Huck 2 | # Copyright (c) 2014-2018 University of Oregon 3 | # 4 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # Make sure the compiler can find include files from our Apex library. 8 | include_directories (${APEX_SOURCE_DIR}/src/apex) 9 | 10 | # gcc on apple needs the apex library to link the dylib 11 | # if(APPLE) 12 | link_directories (${APEX_BINARY_DIR}/src/apex) 13 | # endif() 14 | 15 | # Create a library called "ittnotify" which includes the source file 16 | # "ittnotify.cpp". 17 | # The extension is already found. Any number of sources could be listed here. 18 | if (BUILD_STATIC_EXECUTABLES) 19 | add_library (ittnotify STATIC ittnotify.cpp) 20 | else() 21 | add_library (ittnotify SHARED ittnotify.cpp) 22 | endif() 23 | set_target_properties (ittnotify PROPERTIES OUTPUT_NAME ittnotify) 24 | 25 | target_link_libraries (ittnotify apex) 26 | add_dependencies (ittnotify apex) 27 | 28 | # add the binary tree to the search path for include files 29 | # so that we will find ittnotify.h 30 | include_directories ("${PROJECT_BINARY_DIR}/src/apex") 31 | 32 | INSTALL(FILES ittnotify.h DESTINATION include) 33 | INSTALL(FILES legacy/ittnotify.h DESTINATION include/legacy) 34 | 35 | #INSTALL(TARGETS ittnotifyShared ittnotifyStatic 36 | INSTALL(TARGETS ittnotify ittnotify 37 | RUNTIME DESTINATION bin 38 | LIBRARY DESTINATION lib 39 | ARCHIVE DESTINATION lib 40 | LIBRARY DESTINATION lib64 41 | ARCHIVE DESTINATION lib64 42 | ) 43 | 44 | -------------------------------------------------------------------------------- /src/ITTNotify/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2018 Kevin Huck 2 | # Copyright (c) 2014-2018 University of Oregon 3 | # 4 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | if(HPX_WITH_APEX) 8 | include(CMakeLists.lsu) 9 | return() 10 | else() 11 | include(CMakeLists.standalone) 12 | return() 13 | endif() 14 | 15 | -------------------------------------------------------------------------------- /src/ITTNotify/ittnotify_export.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018 University of Oregon 2 | // Copyright (c) 2014-2018 Kevin Huck 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | // 7 | 8 | #ifndef ITTNOTIFY_EXPORT_H 9 | #define ITTNOTIFY_EXPORT_H 10 | 11 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 12 | #define ITTNOTIFY_EXPORT __declspec(dllexport) 13 | #else 14 | #define ITTNOTIFY_EXPORT __attribute__((visibility("default"))) 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ITTNotify/legacy/ittnotify.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018 Kevin Huck 2 | // Copyright (c) 2014-2018 University of Oregon 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | /* This file is only here to make sure compiling works */ 8 | #ifndef LEGACY_ITTNOTIFY_H 9 | #define LEGACY_ITTNOTIFY_H 1 10 | #endif 11 | -------------------------------------------------------------------------------- /src/apex/APEXConfig.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | # find_dependency(xxx 2.0) 3 | include(${CMAKE_CURRENT_LIST_DIR}/APEXTargets.cmake) -------------------------------------------------------------------------------- /src/apex/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2021 Kevin Huck 2 | # Copyright (c) 2014-2021 University of Oregon 3 | # 4 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 5 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | 8 | if(HPX_WITH_APEX) 9 | include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists_hpx.cmake) 10 | return() 11 | else() 12 | include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists_standalone.cmake) 13 | return() 14 | endif() 15 | -------------------------------------------------------------------------------- /src/apex/Config.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the APEX package 2 | # It defines the following variables 3 | # APEX_INCLUDE_DIRS - include directories for APEX 4 | # APEX_LIBRARIES - libraries to link against 5 | # APEX_EXECUTABLE - the executables 6 | 7 | # Compute paths 8 | get_filename_component(APEX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 9 | set(APEX_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") 10 | 11 | # Our library dependencies (contains definitions for IMPORTED targets) 12 | if(NOT TARGET apex AND NOT apex_BINARY_DIR) 13 | include("${APEX_CMAKE_DIR}/APEXTargets.cmake") 14 | endif() 15 | 16 | # These are IMPORTED targets created by MyLibTargets.cmake 17 | set(APEX_LIBRARIES apex) -------------------------------------------------------------------------------- /src/apex/ITTNotify: -------------------------------------------------------------------------------- 1 | ../ITTNotify -------------------------------------------------------------------------------- /src/apex/L0/demangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if __has_include() 4 | #define HAVE_CXXABI 1 5 | #include 6 | #include 7 | #else 8 | #define HAVE_CXXABI 0 9 | #endif 10 | #include 11 | 12 | #include "pti_assert.h" 13 | 14 | namespace utils { 15 | 16 | static inline std::string Demangle(const char* name) { 17 | PTI_ASSERT(name != nullptr); 18 | 19 | #if HAVE_CXXABI 20 | int status = 0; 21 | char* demangled = abi::__cxa_demangle(name, nullptr, 0, &status); 22 | if (status != 0) { 23 | return name; 24 | } 25 | 26 | constexpr const char* const prefix_to_skip = "typeinfo name for "; 27 | const size_t prefix_to_skip_len = strlen(prefix_to_skip); 28 | const size_t shift = 29 | (std::strncmp(demangled, prefix_to_skip, prefix_to_skip_len) == 0) ? 30 | prefix_to_skip_len : 0; 31 | 32 | std::string result(demangled + shift); 33 | free(demangled); 34 | return result; 35 | #else 36 | return name; 37 | #endif 38 | } 39 | 40 | } // namespace utils 41 | 42 | #undef HAVE_CXXABI 43 | -------------------------------------------------------------------------------- /src/apex/L0/pti_assert.h: -------------------------------------------------------------------------------- 1 | //============================================================== 2 | // Copyright © 2020 Intel Corporation 3 | // 4 | // SPDX-License-Identifier: MIT 5 | // ============================================================= 6 | 7 | #pragma once 8 | 9 | #ifdef NDEBUG 10 | #undef NDEBUG 11 | #include 12 | #define NDEBUG 13 | #else 14 | #include 15 | #endif 16 | 17 | #define PTI_ASSERT(X) assert(X) 18 | -------------------------------------------------------------------------------- /src/apex/apex_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | inline void _apex_assert(const char* expression, const char* file, int line) 15 | { 16 | fprintf(stderr, "Assertion '%s' failed, file '%s' line '%d'.", 17 | expression, file, line); 18 | abort(); 19 | } 20 | 21 | #ifdef NDEBUG 22 | #define APEX_ASSERT(EXPRESSION) ((void)0) 23 | #else 24 | #define APEX_ASSERT(EXPRESSION) ((EXPRESSION) ? (void)0 : \ 25 | _apex_assert(#EXPRESSION, __FILE__, __LINE__)) 26 | #endif 27 | -------------------------------------------------------------------------------- /src/apex/apex_clock.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #if defined(APEX_WITH_LEVEL0) // needed to map to GPU time 13 | #define MYCLOCK std::chrono::steady_clock 14 | #else 15 | #define MYCLOCK std::chrono::system_clock 16 | #endif 17 | 18 | namespace apex { 19 | 20 | class our_clock { 21 | public: 22 | // need this before the task_wrapper uses it. 23 | static uint64_t time_point_to_nanoseconds(std::chrono::time_point tp) { 24 | auto value = tp.time_since_epoch(); 25 | uint64_t duration = 26 | std::chrono::duration_cast(value).count(); 27 | return duration; 28 | } 29 | static uint64_t now_ns() { 30 | return time_point_to_nanoseconds(MYCLOCK::now()); 31 | } 32 | }; 33 | 34 | } // namespace 35 | 36 | -------------------------------------------------------------------------------- /src/apex/apex_config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | // the configured options and settings for Apex 12 | #define APEX_VERSION_MAJOR @APEX_VERSION_MAJOR@ 13 | #define APEX_VERSION_MINOR @APEX_VERSION_MINOR@ 14 | 15 | // Git related strings 16 | #define GIT_TAG "@GIT_TAG@" 17 | #define GIT_BRANCH "@GIT_BRANCH@" 18 | #define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" 19 | 20 | // the ACTIVEHARMONY installation location 21 | #define ACTIVEHARMONY_ROOT "@ACTIVEHARMONY_ROOT@" 22 | 23 | -------------------------------------------------------------------------------- /src/apex/apex_error_handling.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | void apex_print_backtrace(); 12 | void apex_custom_signal_handler(int sig); 13 | int apex_register_signal_handler(); 14 | int apex_register_thread_cleanup(); 15 | int apex_custom_signal_handler_thread_exit(int sig); 16 | void apex_test_signal_handler(); 17 | void apex_signal_all_threads(); 18 | 19 | -------------------------------------------------------------------------------- /src/apex/apex_export.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #ifndef APEX_EXPORT_H 12 | #define APEX_EXPORT_H 13 | 14 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 15 | #if defined(HPX_LIBRARY_EXPORTS) 16 | #define APEX_EXPORT __declspec(dllexport) 17 | #else 18 | #define APEX_EXPORT __declspec(dllimport) 19 | #endif 20 | #define APEX_WEAK_PRE 21 | #define APEX_WEAK_POST 22 | #else 23 | 24 | #define APEX_EXPORT __attribute__((visibility("default"))) 25 | 26 | #ifdef __clang__ 27 | #define APEX_WEAK_PRE 28 | #define APEX_WEAK_POST __attribute__((weak_import)) 29 | #else 30 | #define APEX_WEAK_PRE __attribute__((weak)) 31 | #define APEX_WEAK_POST 32 | #endif 33 | 34 | #endif 35 | 36 | #if defined(_MSC_VER) || defined(__clang__) 37 | #define APEX_TOP_LEVEL_PACKAGE ::apex 38 | #else 39 | #define APEX_TOP_LEVEL_PACKAGE apex 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/apex/apex_kokkos.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | typedef struct KokkosPDeviceInfo { 14 | uint32_t deviceID; 15 | } KokkosPDeviceInfo_t; 16 | 17 | /* This handle describes a Kokkos memory space. The name member is a 18 | * zero-padded string which currently can take the values "Host" or "Cuda". 19 | */ 20 | typedef struct SpaceHandle { 21 | char name[64]; 22 | } SpaceHandle_t; 23 | -------------------------------------------------------------------------------- /src/apex/apex_mpif.F90: -------------------------------------------------------------------------------- 1 | 2 | subroutine apex_mpi_fortran_init_predefined_constants() 3 | include 'mpif.h' 4 | call apex_mpi_predef_init_in_place(MPI_IN_PLACE) 5 | call apex_mpi_predef_init_bottom(MPI_BOTTOM) 6 | call apex_mpi_predef_init_status_ignore(MPI_STATUS_IGNORE) 7 | call apex_mpi_predef_init_statuses_ignore(MPI_STATUSES_IGNORE) 8 | call apex_mpi_predef_init_unweighted(MPI_UNWEIGHTED) 9 | return 10 | end subroutine apex_mpi_fortran_init_predefined_constants 11 | 12 | subroutine apex_mpi_fortran_init_predefined_constants_() 13 | include 'mpif.h' 14 | call apex_mpi_predef_init_in_place(MPI_IN_PLACE) 15 | call apex_mpi_predef_init_bottom(MPI_BOTTOM) 16 | call apex_mpi_predef_init_status_ignore(MPI_STATUS_IGNORE) 17 | call apex_mpi_predef_init_statuses_ignore(MPI_STATUSES_IGNORE) 18 | call apex_mpi_predef_init_unweighted(MPI_UNWEIGHTED) 19 | return 20 | end subroutine apex_mpi_fortran_init_predefined_constants_ 21 | -------------------------------------------------------------------------------- /src/apex/apex_nvml.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "apex.hpp" 12 | #include "nvml.h" 13 | #include 14 | #include 15 | 16 | namespace apex { namespace nvml { 17 | 18 | class monitor { 19 | public: 20 | void query(); 21 | void stop(); 22 | static void activateDeviceIndex(uint32_t index); 23 | static monitor& instance(); 24 | private: 25 | /* declare the constructor, only used by the "instance" method. 26 | * it is defined in the cpp file. */ 27 | monitor (void); 28 | ~monitor (void); 29 | /* Disable the copy and assign methods. */ 30 | monitor(monitor const&) = delete; 31 | void operator=(monitor const&) = delete; 32 | bool success; 33 | uint32_t deviceCount; 34 | std::vector devices; 35 | std::vector queried_once; 36 | static std::set activeDeviceIndices; 37 | static std::mutex indexMutex; 38 | double convertValue(nvmlFieldValue_t &value); 39 | }; // class monitor 40 | 41 | } // namespace nvml 42 | } // namespace apex 43 | -------------------------------------------------------------------------------- /src/apex/apex_opencl.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace apex { 3 | namespace opencl { 4 | void shutdown(void); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/apex/apex_policies.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "apex_export.h" 12 | 13 | extern bool apex_throttleOn; // Current Throttle status 14 | extern bool apex_checkThrottling; // Is thread throttling desired 15 | extern bool apex_energyThrottling; // Try to save power while throttling 16 | 17 | typedef enum { 18 | INITIAL_STATE, 19 | BASELINE, 20 | INCREASE, 21 | DECREASE, 22 | NO_CHANGE} last_action_t; 23 | 24 | // system specific cutoff to identify busy systems, WATTS 25 | #define APEX_HIGH_POWER_LIMIT 220.0 26 | // system specific cutoff to identify busy systems, WATTS 27 | #define APEX_LOW_POWER_LIMIT 200.0 28 | 29 | #define APEX_MAX_THREADS 24 30 | #define APEX_MIN_THREADS 1 31 | #define MAX_WINDOW_SIZE 3 32 | 33 | -------------------------------------------------------------------------------- /src/apex/apex_raja.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "apex_raja.hpp" 10 | 11 | // Statically loading plugin. 12 | static RAJA::util::PluginRegistry::add P("APEX", "APEX - Autonomic Performance Environment for eXascale"); 13 | 14 | // Dynamically loading plugin. 15 | extern "C" RAJA::util::PluginStrategy *getPlugin () 16 | { 17 | return new ApexPlugin; 18 | } -------------------------------------------------------------------------------- /src/apex/apex_version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #ifndef VERSION_H 10 | #define VERSION_H 11 | 12 | #define GIT_TAG "@GIT_TAG@" 13 | #define GIT_BRANCH "@GIT_BRANCH@" 14 | #define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" 15 | #define ACTIVEHARMONY_ROOT "@ACTIVEHARMONY_ROOT@" 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/apex/banner.hpp: -------------------------------------------------------------------------------- 1 | /* From https://patorjk.com/software/taag/ */ 2 | 3 | const char * banner_fire = R"( ( ) 4 | ( )\ ) ( /( 5 | )\ (()/( ( )\()) 6 | ((((_)( /(_)))\ ((_)\ 7 | )\ _ )\ (_)) ((_) __((_) 8 | (_)_\(_)| _ \| __|\ \/ / 9 | / _ \ | _/| _| > < 10 | /_/ \_\ |_| |___|/_/\_\ 11 | )"; 12 | 13 | const char * banner_doom = R"( ___ ______ _______ __ 14 | / _ \ | ___ \ ___\ \ / / 15 | / /_\ \| |_/ / |__ \ V / 16 | | _ || __/| __| / \ 17 | | | | || | | |___/ /^\ \ 18 | \_| |_/\_| \____/\/ \/ 19 | )"; 20 | 21 | const char * banner_bloody = R"( ▄▄▄ ██▓███ ▓█████ ▒██ ██▒ 22 | ▒████▄ ▓██░ ██▒▓█ ▀ ▒▒ █ █ ▒░ 23 | ▒██ ▀█▄ ▓██░ ██▓▒▒███ ░░ █ ░ 24 | ░██▄▄▄▄██ ▒██▄█▓▒ ▒▒▓█ ▄ ░ █ █ ▒ 25 | ▓█ ▓██▒▒██▒ ░ ░░▒████▒▒██▒ ▒██▒ 26 | ▒▒ ▓▒█░▒▓▒░ ░ ░░░ ▒░ ░▒▒ ░ ░▓ ░ 27 | ▒ ▒▒ ░░▒ ░ ░ ░ ░░░ ░▒ ░ 28 | ░ ▒ ░░ ░ ░ ░ 29 | ░ ░ ░ ░ ░ ░ 30 | )"; 31 | 32 | #if CMAKE_BUILD_TYPE == 1 33 | #define apex_banner banner_fire 34 | #elif CMAKE_BUILD_TYPE == 2 35 | #define apex_banner banner_doom 36 | #else // == 3 37 | #define apex_banner banner_bloody 38 | #endif 39 | -------------------------------------------------------------------------------- /src/apex/csv_parser.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace apex { 6 | namespace treemerge { 7 | 8 | std::vector csv_read_row(std::istream &in, char delimiter); 9 | std::vector csv_read_row(std::string &in, char delimiter); 10 | void csv_write(std::vector header, 11 | std::vector>*> &ranks, 12 | std::string filename); 13 | 14 | } // namespace treemerge 15 | } // namespace apex 16 | -------------------------------------------------------------------------------- /src/apex/event_filter.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "apex.hpp" 12 | #include "apex_options.hpp" 13 | #include 14 | #include 15 | 16 | namespace apex { 17 | 18 | class event_filter { 19 | public: 20 | static bool exclude(const std::string &name); 21 | static event_filter& instance(void); 22 | bool have_filter; 23 | private: 24 | /* Declare the constructor, only used by the "instance" method. 25 | * it is defined in the cpp file. */ 26 | event_filter(void); 27 | ~event_filter(void) {}; 28 | /* Disable the copy and assign methods. */ 29 | event_filter(event_filter const&) = delete; 30 | void operator=(event_filter const&) = delete; 31 | bool _exclude(const std::string &name); 32 | static event_filter * _instance; 33 | rapidjson::Document configuration; 34 | }; 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/apex/handler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #include "handler.hpp" 10 | 11 | #if defined(_MSC_VER) || defined(__APPLE__) 12 | namespace apex { 13 | std::chrono::microseconds handler::default_period(100000); 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /src/apex/hip_profiler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "apex.hpp" 12 | #include "rocprofiler.h" 13 | #include 14 | 15 | namespace apex { namespace rocprofiler { 16 | 17 | class monitor { 18 | public: 19 | void query(); 20 | void stop(); 21 | static monitor& instance(); 22 | private: 23 | /* declare the constructor, only used by the "instance" method. 24 | * it is defined in the cpp file. */ 25 | monitor (void); 26 | ~monitor (void); 27 | /* Disable the copy and assign methods. */ 28 | monitor(monitor const&) = delete; 29 | void operator=(monitor const&) = delete; 30 | bool enabled; 31 | // HSA status 32 | hsa_status_t status; 33 | // Profiling context 34 | rocprofiler_t* context; 35 | // Profiling properties 36 | rocprofiler_properties_t properties; 37 | // Profiling feature objects 38 | unsigned feature_count; 39 | // there won't be more than 8 counters, but this is easier than a dynamic size. 40 | rocprofiler_feature_t feature[16]; 41 | unsigned group_n; 42 | }; // class monitor 43 | 44 | } // namespace rocm_profiler 45 | } // namespace apex 46 | -------------------------------------------------------------------------------- /src/apex/otf2_listener_nompi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | /* This file contains MPI implementations of communication necessary to support 10 | OTF2 tracing. For example, event unification and clock Synchronization. 11 | */ 12 | 13 | // only compile this file if we have NO networking support! 14 | #if defined(APEX_HAVE_HPX_CONFIG) || defined(APEX_HAVE_HPX) 15 | #include 16 | #include 17 | #endif 18 | 19 | #if !defined(HPX_HAVE_NETWORKING) && !defined(APEX_WITH_MPI) 20 | 21 | #include "otf2_listener.hpp" 22 | 23 | namespace apex { 24 | 25 | int64_t otf2_listener::synchronizeClocks(void) { 26 | return 0; 27 | } 28 | 29 | int otf2_listener::getCommRank() { 30 | return apex::instance()->get_node_id(); 31 | } 32 | 33 | int otf2_listener::getCommSize() { 34 | return apex::instance()->get_num_ranks(); 35 | } 36 | 37 | } // namespace apex 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/apex/perfetto_static.cpp: -------------------------------------------------------------------------------- 1 | #include "perfetto_static.hpp" 2 | 3 | // Reserves internal static storage for our tracing categories. 4 | PERFETTO_TRACK_EVENT_STATIC_STORAGE(); 5 | -------------------------------------------------------------------------------- /src/apex/perfetto_static.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "perfetto.h" 12 | 13 | // The set of track event categories that the example is using. 14 | PERFETTO_DEFINE_CATEGORIES( 15 | perfetto::Category("APEX") 16 | .SetDescription("Autonomic Performance Environment for eXascale")); 17 | 18 | -------------------------------------------------------------------------------- /src/apex/profile_reducer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include "apex_types.h" 15 | #include "profiler_listener.hpp" 16 | 17 | namespace apex { 18 | 19 | std::map reduce_profiles_for_screen(); 20 | 21 | void reduce_profiles(std::stringstream& header, 22 | std::stringstream& csv_output, std::string filename, bool flat); 23 | void reduce_flat_profiles(int node_id, int num_papi_counters, 24 | std::vector metric_names, 25 | profiler_listener* listener); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/apex/sensor_data.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | namespace apex { 14 | 15 | class sensor_data { 16 | public: 17 | sensor_data(void); 18 | ~sensor_data(void); 19 | std::string get_version(void); 20 | void read_sensors(void); 21 | }; 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/apex/task_dependency.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "task_identifier.hpp" 12 | 13 | namespace apex { 14 | 15 | class task_dependency { 16 | public: 17 | task_identifier parent; 18 | task_identifier child; 19 | task_dependency(task_identifier * p, task_identifier * c) : 20 | parent(*p), child(*c) {}; 21 | ~task_dependency() { } 22 | }; 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/apex/tcmalloc_hooks.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #pragma once 10 | 11 | #ifdef APEX_HAVE_TCMALLOC 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace apex { 19 | namespace tcmalloc { 20 | 21 | class tracker { 22 | public: 23 | std::atomic hostTotalAllocated; 24 | std::unordered_map hostMemoryMap; 25 | std::mutex hostMapMutex; 26 | tracker() : hostTotalAllocated(0) { } 27 | }; 28 | 29 | bool& inWrapper(void); 30 | void NewHook(const void* ptr, size_t size); 31 | void DeleteHook(const void* ptr); 32 | void init_hook(); 33 | void destroy_hook(); 34 | 35 | } 36 | } 37 | #endif // APEX_HAVE_TCMALLOC 38 | -------------------------------------------------------------------------------- /src/apex/threadpool.cpp: -------------------------------------------------------------------------------- 1 | #include "threadpool.h" 2 | 3 | namespace apex { 4 | namespace treemerge { 5 | 6 | void ThreadPool::Start(void) { 7 | for (uint32_t ii = 0; ii < nthreads; ++ii) { 8 | threads.emplace_back(std::thread(&ThreadPool::ThreadLoop,this)); 9 | } 10 | } 11 | 12 | void ThreadPool::ThreadLoop(void) { 13 | while (true) { 14 | std::function job; 15 | { 16 | std::unique_lock lock(queue_mutex); 17 | mutex_condition.wait(lock, [this] { 18 | return !jobs.empty() || should_terminate; 19 | }); 20 | if (should_terminate) { 21 | return; 22 | } 23 | job = jobs.front(); 24 | jobs.pop(); 25 | } 26 | job(); 27 | } 28 | } 29 | 30 | void ThreadPool::QueueJob(const std::function& job) { 31 | { 32 | std::unique_lock lock(queue_mutex); 33 | jobs.push(job); 34 | } 35 | mutex_condition.notify_one(); 36 | } 37 | 38 | bool ThreadPool::busy(void) { 39 | bool poolbusy; 40 | { 41 | std::unique_lock lock(queue_mutex); 42 | poolbusy = !jobs.empty(); 43 | } 44 | return poolbusy; 45 | } 46 | 47 | void ThreadPool::Stop(void) { 48 | { 49 | std::unique_lock lock(queue_mutex); 50 | should_terminate = true; 51 | } 52 | mutex_condition.notify_all(); 53 | for (std::thread& active_thread : threads) { 54 | active_thread.join(); 55 | } 56 | threads.clear(); 57 | } 58 | 59 | } // namespace treemerge 60 | } // namespace apex 61 | 62 | -------------------------------------------------------------------------------- /src/apex/threadpool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "utils.hpp" 10 | 11 | namespace apex { 12 | namespace treemerge { 13 | 14 | class ThreadPool { 15 | public: 16 | ThreadPool(uint32_t size = my_hardware_concurrency()) : 17 | nthreads(size) {}; 18 | void Start(void); 19 | void QueueJob(const std::function& job); 20 | void Stop(void); 21 | bool busy(void); 22 | uint32_t getNthreads(void) { return nthreads; }; 23 | 24 | private: 25 | void ThreadLoop(void); 26 | 27 | bool should_terminate = false; // Tells threads to stop looking for jobs 28 | std::mutex queue_mutex; // Prevents data races to the job queue 29 | std::condition_variable mutex_condition; // Allows threads to wait on new jobs or termination 30 | std::vector threads; 31 | std::queue> jobs; 32 | uint32_t nthreads; 33 | }; 34 | 35 | } // namespace treemerge 36 | } // namespace apex -------------------------------------------------------------------------------- /src/apex/tool/pmc_input.xml: -------------------------------------------------------------------------------- 1 | # List of metrics 2 | 5 | -------------------------------------------------------------------------------- /src/apex/tool/pmc_input1.xml: -------------------------------------------------------------------------------- 1 | # Filter by dispatches range, GPU index and kernel names 2 | 10 | 11 | # List of metrics 12 | 15 | -------------------------------------------------------------------------------- /src/comm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") 2 | 3 | # install the header. 4 | INSTALL(FILES apex_global.h DESTINATION include) 5 | 6 | -------------------------------------------------------------------------------- /src/comm/apex_global.h: -------------------------------------------------------------------------------- 1 | #ifndef APEX_GLOBAL_H 2 | #define APEX_GLOBAL_H 3 | 4 | /* required for Doxygen */ 5 | /** @file */ 6 | 7 | #include "apex.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C"{ 11 | #endif 12 | 13 | /** 14 | \brief the function declaration, this is the funcion that does the reduction 15 | 16 | \param unused Unused value. 17 | \returns 0 on no error. 18 | */ 19 | int action_apex_reduce(void *unused); 20 | 21 | /** 22 | \brief Each node has to populate their local value 23 | 24 | \param args Local data to be exchanged globally. 25 | \returns 0 on no error. 26 | */ 27 | int action_apex_get_value(void *args); 28 | 29 | /** 30 | \brief A policy function to do periodic output 31 | 32 | \param context The context for the periodic policy. 33 | \returns 0 on no error. 34 | */ 35 | int apex_periodic_policy_func(apex_context const context) ; 36 | 37 | /** 38 | \brief The function to set up global reductions 39 | 40 | \param type The type of the profiler 41 | \param in_action The name of a timer or address of a function. 42 | This is the function timer that should be reduced globally. 43 | This value is used for the example. 44 | \returns 0 on no error. 45 | */ 46 | void apex_global_setup(apex_profiler_type type, void* in_action); 47 | 48 | /** 49 | \brief The function to tear down global reductions, if necessary 50 | */ 51 | void apex_global_teardown(void); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/examples/CountCalls/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "count_calls" that is built from the source file 8 | # "count_calls.cpp". The extensions are automatically found. 9 | add_executable (count_calls count_calls.cpp) 10 | add_dependencies (count_calls apex) 11 | add_dependencies (examples count_calls) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (count_calls apex ${LIBS}) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(count_calls PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS count_calls 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/CustomTuning/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "custom_tuning" that is built from the source file 8 | # "custom_tuning.cpp". The extensions are automatically found. 9 | add_executable (custom_tuning custom_tuning.cpp) 10 | add_dependencies (custom_tuning apex) 11 | add_dependencies (examples custom_tuning) 12 | 13 | # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 14 | # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 15 | 16 | # Link the executable to the Apex library. 17 | target_link_libraries (custom_tuning apex ${LIBS}) 18 | if (BUILD_STATIC_EXECUTABLES) 19 | set_target_properties(custom_tuning PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 20 | endif() 21 | 22 | INSTALL(TARGETS custom_tuning 23 | RUNTIME DESTINATION bin OPTIONAL 24 | ) 25 | -------------------------------------------------------------------------------- /src/examples/DemoC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "apexCDemo" that is built from the source file 8 | # "demo.c". The extensions are automatically found. 9 | add_executable (apexCDemo demo.c) 10 | 11 | # Link the executable to the Apex library. 12 | target_link_libraries (apexCDemo apex ${LIBS} ${APEX_STDCXX_LIB} m) 13 | if (BUILD_STATIC_EXECUTABLES) 14 | set_target_properties(apexCDemo PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 15 | endif() 16 | add_dependencies (apexCDemo apex) 17 | add_dependencies (examples apexCDemo) 18 | 19 | INSTALL(TARGETS apexCDemo 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/DemoC/demo.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 7 | int j = i * i; 8 | apex_stop(profiler); 9 | return j; 10 | } 11 | 12 | int main (int argc, char** argv) { 13 | apex_init(argv[0], 0, 1); 14 | printf("APEX Version : %s\n", apex_version()); 15 | apex_print_options(); 16 | apex_set_use_screen_output(1); 17 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 18 | int i,j = 0; 19 | for (i = 0 ; i < 3 ; i++) 20 | j += foo(i); 21 | apex_stop(profiler); 22 | apex_finalize(); 23 | apex_cleanup(); 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/examples/DemoCpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "apexCppDemo" that is built from the source file 8 | # "demo.cpp". The extensions are automatically found. 9 | add_executable (apexCppDemo demo.cpp) 10 | 11 | # Link the executable to the Apex library. 12 | target_link_libraries (apexCppDemo apex ${LIBS}) 13 | if (BUILD_STATIC_EXECUTABLES) 14 | set_target_properties(apexCppDemo PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 15 | endif() 16 | add_dependencies (apexCppDemo apex) 17 | add_dependencies (examples apexCppDemo) 18 | 19 | INSTALL(TARGETS apexCppDemo 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/EventFilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "apexCppDemo" that is built from the source file 8 | # "demo.cpp". The extensions are automatically found. 9 | add_executable (eventFilterExample eventfilter_example.cpp) 10 | 11 | # Link the executable to the Apex library. 12 | target_link_libraries (eventFilterExample apex ${LIBS}) 13 | if (BUILD_STATIC_EXECUTABLES) 14 | set_target_properties(eventFilterExample PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 15 | endif() 16 | add_dependencies (eventFilterExample apex) 17 | add_dependencies (examples eventFilterExample) 18 | 19 | INSTALL(TARGETS eventFilterExample 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/EventFilter/event_filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["scoped.*"], 3 | "include": ["task.*", "main"] 4 | } -------------------------------------------------------------------------------- /src/examples/LuleshMPI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | include_directories (${APEX_SOURCE_DIR}/src/apex ${APEX_SOURCE_DIR}/src/comm ${MPI_CXX_INCLUDE_PATH}) 8 | 9 | # Make sure the linker can find the Apex library once it is built. 10 | link_directories (${APEX_BINARY_DIR}/src/apex ${APEX_BINARY_DIR}/src/comm/mpi) 11 | 12 | # Add executable called "lulesh_MPI_2.0" that is built from the source file 13 | # "lulesh.cc". The extensions are automatically found. 14 | add_executable (lulesh_MPI_2.0 lulesh.cc lulesh-comm.cc lulesh-init.cc lulesh-util.cc lulesh-viz.cc) 15 | add_dependencies (lulesh_MPI_2.0 apex) 16 | add_dependencies (examples lulesh_MPI_2.0) 17 | 18 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -DAPEX_ENABLE_MPI=1") 19 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DAPEX_ENABLE_MPI=1") 20 | 21 | # Link the executable to the Apex library. 22 | target_link_libraries (lulesh_MPI_2.0 apex apex_mpi apex_global_mpi 23 | ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 24 | if (BUILD_STATIC_EXECUTABLES) 25 | set_target_properties(lulesh_MPI_2.0 PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 26 | endif() 27 | 28 | INSTALL(TARGETS lulesh_MPI_2.0 29 | RUNTIME DESTINATION bin OPTIONAL 30 | ) 31 | -------------------------------------------------------------------------------- /src/examples/LuleshMPIOpenMP/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | include_directories (${APEX_SOURCE_DIR}/src/apex ${OMPT_INCLUDE_DIR} ${APEX_SOURCE_DIR}/src/comm ${MPI_CXX_INCLUDE_PATH}) 8 | 9 | # Make sure the linker can find the Apex library once it is built. 10 | link_directories (${APEX_BINARY_DIR}/src/apex ${APEX_BINARY_DIR}/src/comm/mpi) 11 | 12 | # Add executable called "lulesh_MPI_OpenMP_2.0" that is built from the source file 13 | # "lulesh.cc". The extensions are automatically found. 14 | add_executable (lulesh_MPI_OpenMP_2.0 lulesh.cc lulesh-comm.cc lulesh-init.cc lulesh-util.cc lulesh-viz.cc synchronous_policy.cpp) 15 | add_dependencies (lulesh_MPI_OpenMP_2.0 apex) 16 | add_dependencies (examples lulesh_MPI_OpenMP_2.0) 17 | 18 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -O3 -DAPEX_ENABLE_MPI=1 -Wall") 19 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -O3 -DAPEX_ENABLE_MPI=1 -Wall") 20 | 21 | # Link the executable to the Apex library. 22 | target_link_libraries (lulesh_MPI_OpenMP_2.0 apex apex_mpi apex_global_mpi ${OMPT_LIBRARIES} 23 | ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS}) 24 | if (BUILD_STATIC_EXECUTABLES) 25 | set_target_properties(lulesh_MPI_OpenMP_2.0 PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 26 | endif() 27 | 28 | INSTALL(TARGETS lulesh_MPI_OpenMP_2.0 29 | RUNTIME DESTINATION bin OPTIONAL 30 | ) 31 | -------------------------------------------------------------------------------- /src/examples/LuleshMPIOpenMP/synchronous_policy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "apex_api.hpp" 4 | 5 | int apex_example_policy_func(apex_context const context); 6 | void apex_example_set_function_address(apex_function_address addr); 7 | long apex_example_get_active_threads(void); 8 | void apex_example_set_rank_info(int me, int all); 9 | -------------------------------------------------------------------------------- /src/examples/LuleshOpenMP/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex ${OMPT_INCLUDE_DIR}) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "lulesh_OpenMP_2.0" that is built from the source file 8 | # "lulesh.cc". The extensions are automatically found. 9 | add_executable (lulesh_OpenMP_2.0 lulesh.cc lulesh-comm.cc lulesh-init.cc lulesh-util.cc lulesh-viz.cc) 10 | add_dependencies (lulesh_OpenMP_2.0 apex) 11 | add_dependencies (examples lulesh_OpenMP_2.0) 12 | 13 | set (CMAKE_C_FLAGS_RELEASE "-O3") # can't exceed this, for math reasons. 14 | set (CMAKE_CXX_FLAGS_RELEASE "-O3") # can't exceed this, for math reasons. 15 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -DAPEX_ENABLE_MPI=0 -Wall") 16 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -DAPEX_ENABLE_MPI=0 -Wall") 17 | 18 | # Link the executable to the Apex library. 19 | target_link_libraries (lulesh_OpenMP_2.0 apex ${OMPT_LIBRARIES} ${LIBS}) 20 | if (BUILD_STATIC_EXECUTABLES) 21 | set_target_properties(lulesh_OpenMP_2.0 PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 22 | endif() 23 | 24 | INSTALL(TARGETS lulesh_OpenMP_2.0 25 | RUNTIME DESTINATION bin OPTIONAL 26 | ) 27 | -------------------------------------------------------------------------------- /src/examples/MPIAutoBalance/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 8 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${APEX_SOURCE_DIR}/src/comm ${MPI_CXX_INCLUDE_PATH} ${OMPT_INCLUDE_DIR}) 9 | 10 | # Make sure the linker can find the Apex library once it is built. 11 | link_directories (${APEX_BINARY_DIR}/src/apex) 12 | link_directories (${APEX_BINARY_DIR}/src/wrappers) 13 | link_directories (${APEX_BINARY_DIR}/src/comm/mpi) 14 | 15 | # Add executable called "mpi_auto_balance" that is built from the source file 16 | # "mpi_auto_balance.cpp". The extensions are automatically found. 17 | add_executable (mpi_auto_balance mpi_auto_balance.cpp synchronous_policy.cpp) 18 | 19 | # Link the executable to the Apex library. 20 | # Note: that stupid -lapex_pthread_wrapper is required on the buildbot system. 21 | target_link_libraries (mpi_auto_balance apex_pthread_wrapper apex_mpi apex_global_mpi apex ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} -lapex_pthread_wrapper) 22 | if (BUILD_STATIC_EXECUTABLES) 23 | set_target_properties(mpi_auto_balance PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 24 | endif() 25 | add_dependencies (mpi_auto_balance apex apex_pthread_wrapper) 26 | add_dependencies (examples mpi_auto_balance) 27 | 28 | ## Compiler flags 29 | set(CMAKE_CXX_FLAGS_RELEASE "-O3") 30 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O3") 31 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 32 | 33 | INSTALL(TARGETS mpi_auto_balance 34 | RUNTIME DESTINATION bin OPTIONAL 35 | ) 36 | -------------------------------------------------------------------------------- /src/examples/MPIAutoBalance/synchronous_policy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "apex_api.hpp" 4 | 5 | int apex_example_policy_func(apex_context const context); 6 | void apex_example_set_function_address(apex_function_address addr); 7 | long apex_example_get_active_threads(void); 8 | void apex_example_set_rank_info(int me, int all); 9 | -------------------------------------------------------------------------------- /src/examples/MPIGlobalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 8 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${APEX_SOURCE_DIR}/src/comm ${MPI_CXX_INCLUDE_PATH}) 9 | 10 | # Make sure the linker can find the Apex library once it is built. 11 | link_directories (${APEX_BINARY_DIR}/src/apex ${APEX_BINARY_DIR}/src/comm/mpi) 12 | 13 | # Add executable called "mpi_global_test" that is built from the source file 14 | # "mpi_test.cpp". The extensions are automatically found. 15 | add_executable (mpi_global_test mpi_test.cpp) 16 | add_dependencies (mpi_global_test apex apex_mpi apex_global_mpi) 17 | add_dependencies (examples mpi_global_test) 18 | 19 | # Link the executable to the Apex library. 20 | target_link_libraries (mpi_global_test apex apex_mpi apex_global_mpi ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 21 | if (BUILD_STATIC_EXECUTABLES) 22 | set_target_properties(mpi_global_test PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 23 | endif() 24 | 25 | if(OpenMP_CXX_FOUND) 26 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 27 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 28 | endif(OpenMP_CXX_FOUND) 29 | 30 | INSTALL(TARGETS mpi_global_test 31 | RUNTIME DESTINATION bin OPTIONAL 32 | ) 33 | -------------------------------------------------------------------------------- /src/examples/MPIImbalancePolicy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 8 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${APEX_SOURCE_DIR}/src/comm ${MPI_CXX_INCLUDE_PATH}) 9 | 10 | # Make sure the linker can find the Apex library once it is built. 11 | link_directories (${APEX_BINARY_DIR}/src/apex ${APEX_BINARY_DIR}/src/comm/mpi) 12 | 13 | # Add executable called "mpi_imbalance_test" that is built from the source file 14 | # "mpi_test.cpp". The extensions are automatically found. 15 | add_executable (mpi_imbalance_test mpi_test.cpp) 16 | add_dependencies (mpi_imbalance_test apex apex_mpi apex_global_mpi) 17 | add_dependencies (examples mpi_imbalance_test) 18 | 19 | # Link the executable to the Apex library. 20 | target_link_libraries (mpi_imbalance_test apex apex_mpi apex_global_mpi ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 21 | if (BUILD_STATIC_EXECUTABLES) 22 | set_target_properties(mpi_imbalance_test PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 23 | endif() 24 | 25 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 26 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 27 | 28 | INSTALL(TARGETS mpi_imbalance_test 29 | RUNTIME DESTINATION bin OPTIONAL 30 | ) 31 | -------------------------------------------------------------------------------- /src/examples/MPITest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure that spaces in linker lines don't cause CMake errors 2 | #if (POLICY CMP0004) 3 | # cmake_policy(SET CMP0004 OLD) 4 | #endif() 5 | 6 | # Make sure the compiler can find include files from our Apex library. 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 8 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${MPI_CXX_INCLUDE_PATH}) 9 | 10 | # Make sure the linker can find the Apex library once it is built. 11 | link_directories (${APEX_BINARY_DIR}/src/apex) 12 | 13 | # Add executable called "mpi_test" that is built from the source file 14 | # "mpi_test.cpp". The extensions are automatically found. 15 | add_executable (mpi_test mpi_test.cpp) 16 | add_dependencies (mpi_test apex) 17 | add_dependencies (examples mpi_test) 18 | 19 | # Link the executable to the Apex library. 20 | target_link_libraries (mpi_test apex apex_mpi ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 21 | if (BUILD_STATIC_EXECUTABLES) 22 | set_target_properties(mpi_test PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 23 | endif() 24 | 25 | INSTALL(TARGETS mpi_test 26 | RUNTIME DESTINATION bin OPTIONAL 27 | ) 28 | -------------------------------------------------------------------------------- /src/examples/Matmult/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (. ${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "apexCDemo" that is built from the source file 8 | # "demo.c". The extensions are automatically found. 9 | add_executable (matmult matmult_initialize.cpp matmult.cpp) 10 | add_dependencies (matmult apex) 11 | add_dependencies (examples matmult) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (matmult apex ${LIBS} ${APEX_STDCXX_LIB} m) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(matmult PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS matmult 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/Matmult/matmult_initialize.cpp: -------------------------------------------------------------------------------- 1 | #include "matmult_initialize.h" 2 | #include "apex_api.hpp" 3 | 4 | void initialize(double **matrix, int rows, int cols) { 5 | //profiler* p = apex::start((void*)(initialize)); 6 | apex::profiler* p = apex::start(__func__); 7 | int i,j; 8 | { 9 | /*** Initialize matrices ***/ 10 | for (i=0; i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "apex.h" 7 | 8 | #define NUM_THREADS 100 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | // This thread exits with return 13 | void* someThread(void* tmp) 14 | { 15 | UNUSED(tmp); 16 | printf("PID of this process: %d\n", getpid()); 17 | #if defined (__APPLE__) 18 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 19 | #else 20 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 21 | #endif 22 | return NULL; 23 | } 24 | 25 | // This thread exits with pthread_exit 26 | void* someOtherThread(void* tmp) 27 | { 28 | UNUSED(tmp); 29 | printf("PID of this process: %d\n", getpid()); 30 | #if defined (__APPLE__) 31 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 32 | #else 33 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 34 | #endif 35 | pthread_exit(NULL); 36 | } 37 | 38 | int main(int argc, char **argv) 39 | { 40 | apex_init(argv[0], 0, 1); 41 | apex_set_use_screen_output(1); 42 | pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * NUM_THREADS)); 43 | int i; 44 | for (i = 0 ; i < NUM_THREADS ; i++) { 45 | if (i % 2 == 0) { 46 | pthread_create(&(thread[i]), NULL, someThread, NULL); 47 | } else { 48 | pthread_create(&(thread[i]), NULL, someOtherThread, NULL); 49 | } 50 | } 51 | for (i = 0 ; i < NUM_THREADS ; i++) { 52 | pthread_join(thread[i], NULL); 53 | } 54 | return(0); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/examples/TestGetPower/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testpower" that is built from the source file 8 | # "getpower.cpp". The extensions are automatically found. 9 | add_executable (testpower getpower.cpp) 10 | 11 | # Link the executable to the Apex library. 12 | target_link_libraries (testpower apex ${LIBS}) 13 | if (BUILD_STATIC_EXECUTABLES) 14 | set_target_properties(testpower PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 15 | endif() 16 | add_dependencies (testpower apex) 17 | add_dependencies (examples testpower) 18 | 19 | INSTALL(TARGETS testpower 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/TestGetPower/getpower.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex::scoped_thread ast("threadTest thread"); 16 | apex::scoped_timer proxy((apex_function_address)someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | return NULL; 24 | } 25 | 26 | 27 | int main(int argc, char **argv) 28 | { 29 | APEX_UNUSED(argc); 30 | apex::init(argv[0], 0, 1); 31 | apex::scoped_timer proxy(__func__); 32 | double currentpower = apex::current_power_high(); 33 | printf("Power at start: %f Watts\n", currentpower); 34 | printf("PID of this process: %d\n", getpid()); 35 | pthread_t thread[NUM_THREADS]; 36 | int i; 37 | for (i = 0 ; i < NUM_THREADS ; i++) { 38 | pthread_create(&(thread[i]), NULL, someThread, NULL); 39 | } 40 | for (i = 0 ; i < NUM_THREADS ; i++) { 41 | pthread_join(thread[i], NULL); 42 | } 43 | currentpower = apex::current_power_high(); 44 | printf("Power at end: %f Watts\n", currentpower); 45 | proxy.stop(); 46 | apex::finalize(); 47 | return(0); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/examples/TestITT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex ${APEX_SOURCE_DIR}/src/ITTNotify) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex ${APEX_BINARY_DIR}/src/ITTNotify) 6 | 7 | # Add executable called "testITT" that is built from the source file 8 | # "testITT.cpp". The extensions are automatically found. 9 | add_executable (testITT testITT.cpp) 10 | target_link_libraries (testITT ittnotify apex ${LIBS}) 11 | add_dependencies (testITT ittnotify apex) 12 | add_dependencies (examples testITT) 13 | 14 | # Link the executable to the Apex library. 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(testITT PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS testITT 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/TestITT/testITT.cpp: -------------------------------------------------------------------------------- 1 | #include "ittnotify.h" 2 | #include "legacy/ittnotify.h" 3 | #include 4 | #include "apex_api.hpp" 5 | #include "stdio.h" 6 | 7 | int main (int argc, char** argv) { 8 | APEX_UNUSED(argc); 9 | APEX_UNUSED(argv); 10 | apex::init("ITT Test", 0, 1); 11 | __itt_domain* domain = __itt_domain_create("Example.Domain.Global"); 12 | __itt_string_handle* handle_main = __itt_string_handle_create("ittTest.main"); 13 | __itt_task_begin(domain, __itt_null, __itt_null, handle_main); 14 | printf("ITT demo.\n"); 15 | __itt_task_end(domain); 16 | apex::finalize(); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/examples/TestOpenMP/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex ${OMPT_INCLUDE_DIR}) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "openmp_test" that is built from the source file 8 | # "openmp_test.cpp". The extensions are automatically found. 9 | add_executable (openmp_test openmp_test.c) 10 | add_dependencies (openmp_test apex) 11 | add_dependencies (examples openmp_test) 12 | 13 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 14 | 15 | # Link the executable to the Apex library. 16 | target_link_libraries (openmp_test apex ${LIBS} ${OMPT_LIBRARIES} ${APEX_STDCXX_LIB}) 17 | if (BUILD_STATIC_EXECUTABLES) 18 | set_target_properties(openmp_test PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 19 | endif() 20 | 21 | INSTALL(TARGETS openmp_test 22 | RUNTIME DESTINATION bin OPTIONAL 23 | ) 24 | -------------------------------------------------------------------------------- /src/examples/TestReset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testReset" that is built from the source file 8 | # "reset.cpp". The extensions are automatically found. 9 | add_executable (testReset reset.cpp) 10 | 11 | # Link the executable to the Apex library. 12 | target_link_libraries (testReset apex ${LIBS}) 13 | if (BUILD_STATIC_EXECUTABLES) 14 | set_target_properties(testReset PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 15 | endif() 16 | add_dependencies (testReset apex) 17 | add_dependencies (examples testReset) 18 | 19 | INSTALL(TARGETS testReset 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/TestThreads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testThreads" that is built from the source file 8 | # "testThreads.cpp". The extensions are automatically found. 9 | add_executable (testThreads testThreads.cpp) 10 | add_dependencies (testThreads apex) 11 | add_dependencies (examples testThreads) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (testThreads apex ${LIBS}) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(testThreads PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS testThreads 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/TestThreads/testThreads.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex::scoped_thread ast("threadTest thread"); 16 | apex::scoped_timer proxy((apex_function_address)someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | return NULL; 24 | } 25 | 26 | 27 | int main(int argc, char **argv) 28 | { 29 | APEX_UNUSED(argc); 30 | apex::init(argv[0], 0, 1); 31 | apex::scoped_timer proxy(__func__); 32 | printf("PID of this process: %d\n", getpid()); 33 | pthread_t thread[NUM_THREADS]; 34 | int i; 35 | for (i = 0 ; i < NUM_THREADS ; i++) { 36 | pthread_create(&(thread[i]), NULL, someThread, NULL); 37 | } 38 | for (i = 0 ; i < NUM_THREADS ; i++) { 39 | pthread_join(thread[i], NULL); 40 | } 41 | proxy.stop(); 42 | apex::finalize(); 43 | return(0); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/examples/Throttling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testThrottling" that is built from the source file 8 | # "testThrottling.c". The extensions are automatically found. 9 | add_executable (testThrottling testThrottling.c) 10 | add_dependencies (testThrottling apex) 11 | add_dependencies (examples testThrottling) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (testThrottling apex ${LIBS} ${APEX_STDCXX_LIB} m) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(testThrottling PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS testThrottling 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/ThrottlingActiveHarmony/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testThrottlingActiveHarmony" that is built from the source file 8 | # "testThrottlingActiveHarmony.c". The extensions are automatically found. 9 | add_executable (testThrottlingActiveHarmony testThrottlingActiveHarmony.c) 10 | add_dependencies (testThrottlingActiveHarmony apex) 11 | add_dependencies (examples testThrottlingActiveHarmony) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (testThrottlingActiveHarmony apex ${LIBS} ${APEX_STDCXX_LIB} m) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(testThrottlingActiveHarmony PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS testThrottlingActiveHarmony 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/ThrottlingCpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "testThrottlingCpp" that is built from the source file 8 | # "testThrottling.cpp". The extensions are automatically found. 9 | add_executable (testThrottlingCpp testThrottling.cpp) 10 | add_dependencies (testThrottlingCpp apex) 11 | add_dependencies (examples testThrottlingCpp) 12 | 13 | # Link the executable to the Apex library. 14 | target_link_libraries (testThrottlingCpp apex ${LIBS}) 15 | if (BUILD_STATIC_EXECUTABLES) 16 | set_target_properties(testThrottlingCpp PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 17 | endif() 18 | 19 | INSTALL(TARGETS testThrottlingCpp 20 | RUNTIME DESTINATION bin OPTIONAL 21 | ) 22 | -------------------------------------------------------------------------------- /src/examples/TuningRequest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | 7 | # Add executable called "tuning_request" that is built from the source file 8 | # "tuning_request.cpp". The extensions are automatically found. 9 | add_executable (tuning_request tuning_request.cpp) 10 | add_dependencies (tuning_request apex) 11 | add_dependencies (examples tuning_request) 12 | 13 | #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 14 | #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 15 | 16 | # Link the executable to the Apex library. 17 | target_link_libraries (tuning_request apex ${LIBS}) 18 | if (BUILD_STATIC_EXECUTABLES) 19 | set_target_properties(tuning_request PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 20 | endif() 21 | 22 | INSTALL(TARGETS tuning_request 23 | RUNTIME DESTINATION bin OPTIONAL 24 | ) 25 | -------------------------------------------------------------------------------- /src/openmp/ompt_master.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "apex.h" 4 | 5 | int main (void) { 6 | int a, i; 7 | apex_set_use_screen_output(1); 8 | #pragma omp parallel shared(a) private(i) 9 | { 10 | #pragma omp master 11 | a = 0; 12 | // To avoid race conditions, add a barrier here. 13 | #pragma omp for reduction(+:a) 14 | for (i = 0; i < 10; i++) { a += i; } 15 | #pragma omp master 16 | printf ("Sum is %d\n", a); 17 | } 18 | } -------------------------------------------------------------------------------- /src/openmp/ompt_parallel_region.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | __attribute__((noinline)) void foo(void) { 6 | #pragma omp parallel 7 | { 8 | printf("Hello from thread %d of %d\n", 9 | omp_get_thread_num(), 10 | omp_get_num_threads()); 11 | fflush(stdout); 12 | } 13 | } 14 | 15 | __attribute__((noinline)) void bar(void) { 16 | #pragma omp parallel 17 | { 18 | printf("Hello again from thread %d of %d\n", 19 | omp_get_thread_num(), 20 | omp_get_num_threads()); 21 | fflush(stdout); 22 | } 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | foo(); 27 | bar(); 28 | return 0; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/openmp/ompt_reduction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "apex.h" 6 | 7 | /* Example taken from: 8 | https://computing.llnl.gov/tutorials/openMP/#REDUCTION 9 | */ 10 | 11 | int main (int argc, char** argv) { 12 | int i, n, chunk; 13 | double a[100], b[100], result; 14 | apex_set_use_screen_output(1); 15 | 16 | /* Some initializations */ 17 | n = 100; 18 | chunk = 10; 19 | result = 0.0; 20 | for (i=0; i < n; i++) { 21 | a[i] = i * 1.0; 22 | b[i] = i * 2.0; 23 | } 24 | 25 | #pragma omp parallel for default(shared) private(i) schedule(static,chunk) reduction(+:result) 26 | 27 | for (i=0; i < n; i++) 28 | result = result + (a[i] * b[i]); 29 | 30 | printf("Final result= %f\n",result); 31 | 32 | return 0; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/openmp/ompt_sections.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "apex.h" 4 | 5 | void a() { 6 | printf("in function a\n"); 7 | } 8 | void b() { 9 | printf("in function b\n"); 10 | } 11 | void c() { 12 | printf("in function c\n"); 13 | } 14 | 15 | int main (void) { 16 | apex_set_use_screen_output(1); 17 | #pragma omp parallel sections 18 | { 19 | #pragma omp section 20 | a(); 21 | #pragma omp section 22 | b(); 23 | #pragma omp section 24 | c(); 25 | } 26 | } -------------------------------------------------------------------------------- /src/openmp/ompt_single.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "apex.h" 4 | 5 | int main (void) { 6 | int a, i; 7 | apex_set_use_screen_output(1); 8 | #pragma omp parallel shared(a) private(i) 9 | { 10 | #pragma omp master 11 | a = 0; 12 | // To avoid race conditions, add a barrier here. 13 | #pragma omp for reduction(+:a) 14 | for (i = 0; i < 10; i++) { a += i; } 15 | #pragma omp single 16 | printf ("Sum is %d\n", a); 17 | } 18 | } -------------------------------------------------------------------------------- /src/openmp/ompt_sync_region_wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "apex.h" 5 | 6 | /* Example taken from: 7 | https://computing.llnl.gov/tutorials/openMP/#REDUCTION 8 | */ 9 | 10 | int main (int argc, char** argv) { 11 | int i, n; 12 | double a[100], b[100], result; 13 | apex_set_use_screen_output(1); 14 | 15 | /* Some initializations */ 16 | n = 100; 17 | result = 0.0; 18 | for (i=0; i < n; i++) { 19 | a[i] = i * 1.0; 20 | b[i] = i * 2.0; 21 | } 22 | 23 | #pragma omp parallel 24 | { 25 | #pragma omp for 26 | for (i=0; i < n; i++) { 27 | result = result + (a[i] * b[i]); 28 | } 29 | #pragma omp barrier 30 | } 31 | 32 | printf("Final result= %f\n",result); 33 | 34 | return 0; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/openmp/ompt_target_daxpy.cpp: -------------------------------------------------------------------------------- 1 | ompt_target_daxpy.c -------------------------------------------------------------------------------- /src/openmp/ompt_target_matmult.cpp: -------------------------------------------------------------------------------- 1 | ompt_target_matmult.c -------------------------------------------------------------------------------- /src/openmp/ompt_task.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * OpenMp Example - Matrix Multiply - C Version 3 | * Demonstrates a matrix multiply using OpenMP. 4 | * 5 | * Modified from here: 6 | * https://computing.llnl.gov/tutorials/openMP/samples/C/omp_mm.c 7 | * 8 | * For PAPI_FP_INS, the exclusive count for the event: 9 | * for (null) [OpenMP location: file:matmult.c ] 10 | * should be 2E+06 / Number of Threads 11 | ******************************************************************************/ 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | int fib(int n) { 19 | int x,y; 20 | if (n<2) return n; 21 | #pragma omp task untied shared(x) 22 | { x = fib(n-1); } 23 | #pragma omp task untied shared(y) 24 | { y = fib(n-2); } 25 | #pragma omp taskwait 26 | return x+y; 27 | } 28 | 29 | int fibouter(int n) { 30 | int answer = 0; 31 | #pragma omp parallel shared(answer) 32 | { 33 | #pragma omp single 34 | { 35 | #pragma omp task shared(answer) 36 | { 37 | answer = fib(n); 38 | } 39 | } 40 | } 41 | return answer; 42 | } 43 | 44 | int main (int argc, char *argv[]) 45 | { 46 | printf("Main...\n"); 47 | fflush(stdout); 48 | printf ("\nDoing forking tasks..."); fflush(stdout); 49 | fibouter(10); 50 | 51 | printf ("Done.\n"); 52 | fflush(stdout); 53 | 54 | return 0; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/openmp/ompt_thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "apex.h" 5 | 6 | int main (int argc, char** argv) { 7 | apex_set_use_screen_output(1); 8 | #pragma omp parallel 9 | { 10 | printf("Hello from thread %d of %d\n", 11 | omp_get_thread_num(), 12 | omp_get_num_threads()); 13 | fflush(stdout); 14 | } 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/perfetto_sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${APEX_SOURCE_DIR}/src/perfetto_sdk) 2 | # Force C++11 with NVHPC, it crashes otherwise 3 | if (CMAKE_CXX_COMPILER_ID MATCHES NVHPC) 4 | set(CMAKE_CXX_STANDARD 11) 5 | endif() 6 | add_library (perfetto perfetto.cc) 7 | 8 | if (WIN32) 9 | # The perfetto library contains many symbols, so it needs the big object 10 | # format. 11 | target_compile_options(perfetto PRIVATE "/bigobj") 12 | # Disable legacy features in windows.h. 13 | add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX) 14 | # On Windows we should link to WinSock2. 15 | add_dependencies (perfetto ws2_32) 16 | endif (WIN32) 17 | 18 | # Enable standards-compliant mode when using the Visual Studio compiler. 19 | if (MSVC) 20 | target_compile_options(example PRIVATE "/permissive-") 21 | endif (MSVC) 22 | 23 | INSTALL(TARGETS perfetto 24 | PUBLIC_HEADER DESTINATION include 25 | LIBRARY DESTINATION lib 26 | ARCHIVE DESTINATION lib 27 | ) 28 | -------------------------------------------------------------------------------- /src/perfetto_sdk/README.md: -------------------------------------------------------------------------------- 1 | # Perfetto - System profiling, app tracing and trace analysis 2 | 3 | Perfetto is a production-grade open-source stack for performance 4 | instrumentation and trace analysis. It offers services and libraries and for 5 | recording system-level and app-level traces, native + java heap profiling, a 6 | library for analyzing traces using SQL and a web-based UI to visualize and 7 | explore multi-GB traces. 8 | 9 | See https://perfetto.dev/docs or the /docs/ directory for documentation. 10 | -------------------------------------------------------------------------------- /src/scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/scripts/apex_exec 2 | ${PROJECT_BINARY_DIR}/src/scripts/apex_exec @ONLY) 3 | #INSTALL_FILES(bin FILES ${PROJECT_BINARY_DIR}/src/scripts/apex_exec) 4 | 5 | set(APEX_SCRIPTS 6 | consolidate.py 7 | task_scatterplot.py 8 | counter_scatterplot.py 9 | gtrace_merger.py 10 | gtrace_filter.py 11 | roofline_stats.py 12 | apex-treesummary.py 13 | apex-summary.py) 14 | 15 | if (BUILD_STATIC_EXECUTABLES) 16 | INSTALL(FILES ${APEX_SCRIPTS} DESTINATION bin 17 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ 18 | GROUP_EXECUTE GROUP_READ 19 | WORLD_EXECUTE WORLD_READ) 20 | else() 21 | INSTALL(FILES ${PROJECT_BINARY_DIR}/src/scripts/apex_exec apex_pthread_exec ${APEX_SCRIPTS} DESTINATION bin 22 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ 23 | GROUP_EXECUTE GROUP_READ 24 | WORLD_EXECUTE WORLD_READ) 25 | endif() 26 | 27 | -------------------------------------------------------------------------------- /src/scripts/fix_binutils_path.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | binutils_path=$1 4 | 5 | if [ ! -d ${binutils_path}/lib64 ] ; then 6 | ln -s ${binutils_path}/lib ${binutils_path}/lib64 7 | fi 8 | -------------------------------------------------------------------------------- /src/scripts/make_release.txt: -------------------------------------------------------------------------------- 1 | 0) Update develop and master, merge develop into master 2 | 3 | update the version number in CMakeLists.txt, src/apex/CMakeLists.hpx and doc/Doxyfile.in and docs/webdocs/install.md 4 | 5 | git checkout develop 6 | git pull 7 | git checkout master 8 | git pull 9 | git merge develop 10 | 11 | 1) Generate a changelog from the last tag: 12 | 13 | git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:'
  • view commit • %s
  • ' --reverse > changelog.txt 14 | 15 | 2) create a new tag 16 | 17 | git tag -a -F changelog.txt v2.1.1 18 | 19 | 3) push that tag, merge iwth master 20 | 21 | git checkout master 22 | git pull 23 | git merge develop 24 | git checkout develop 25 | git push origin 26 | git push --tags origin 27 | 28 | 4) Update github, make release 29 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_cleanup.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | 3 | int main (int argc, char** argv) { 4 | APEX_UNUSED(argc); 5 | APEX_UNUSED(argv); 6 | apex::init("apex::cleanup unit test", 0, 1); 7 | apex::apex_options::use_screen_output(true); 8 | apex::finalize(); 9 | apex::cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_current_power_high.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex::scoped_thread ast("threadTest thread"); 16 | apex::scoped_timer proxy((uint64_t)&someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | return NULL; 24 | } 25 | 26 | 27 | int main(int argc, char **argv) 28 | { 29 | APEX_UNUSED(argc); 30 | APEX_UNUSED(argv); 31 | apex::init(NULL, 0, 1); 32 | apex::scoped_timer proxy(__func__); 33 | double currentpower = apex::current_power_high(); 34 | printf("Power at start: %f Watts\n", currentpower); 35 | printf("PID of this process: %d\n", getpid()); 36 | pthread_t thread[NUM_THREADS]; 37 | int i; 38 | for (i = 0 ; i < NUM_THREADS ; i++) { 39 | pthread_create(&(thread[i]), NULL, someThread, NULL); 40 | } 41 | for (i = 0 ; i < NUM_THREADS ; i++) { 42 | pthread_join(thread[i], NULL); 43 | } 44 | currentpower = apex::current_power_high(); 45 | printf("Power at end: %f Watts\n", currentpower); 46 | proxy.stop(); 47 | apex::finalize(); 48 | return(0); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_exit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "apex_api.hpp" 4 | 5 | void boo (void) { 6 | apex::profiler* p = apex::start((apex_function_address)&boo); 7 | exit(0); 8 | apex::stop(p); 9 | } 10 | 11 | void bar (void) { 12 | apex::profiler* p = apex::start((apex_function_address)&bar); 13 | boo(); 14 | apex::stop(p); 15 | } 16 | 17 | void foo (void) { 18 | apex::profiler* p = apex::start((apex_function_address)&foo); 19 | bar(); 20 | apex::stop(p); 21 | } 22 | 23 | int main (int argc, char** argv) { 24 | APEX_UNUSED(argc); 25 | APEX_UNUSED(argv); 26 | apex::apex_options::use_screen_output(true); 27 | apex::apex_options::top_level_os_threads(true); 28 | /* initialize APEX */ 29 | apex::init("apex::start unit test", 0, 1); 30 | /* start a timer */ 31 | apex::register_thread("main thread"); 32 | apex::profiler* p = apex::start("main"); 33 | /* Call our function */ 34 | foo(); 35 | /* stop our main timer - not reachable due to exit */ 36 | apex::stop(p); 37 | /* finalize APEX */ 38 | apex::finalize(); 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_exit_thread.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | stop(p); 21 | exit_thread(); 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | init("apex::exit_thread unit test", 0, 1); 29 | cout << "APEX Version : " << version() << endl; 30 | apex_options::print_options(); 31 | profiler* p = start("main"); 32 | pthread_t thread[2]; 33 | int tid = 0; 34 | pthread_create(&(thread[0]), NULL, someThread, &tid); 35 | int tid2 = 1; 36 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 37 | pthread_join(thread[0], NULL); 38 | pthread_join(thread[1], NULL); 39 | stop(p); 40 | finalize(); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_finalize.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | 3 | int main (int argc, char** argv) { 4 | APEX_UNUSED(argc); 5 | APEX_UNUSED(argv); 6 | apex::init("apex::finalize unit test", 0, 1); 7 | apex::apex_options::use_screen_output(true); 8 | apex::finalize(); 9 | apex::cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_init.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | 4 | int main (int argc, char** argv) { 5 | APEX_UNUSED(argc); 6 | APEX_UNUSED(argv); 7 | apex::init("apex::init unit test", 0, 1); 8 | apex::apex_options::use_screen_output(true); 9 | apex::finalize(); 10 | apex::cleanup(); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_init_args.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | 4 | int main (int argc, char** argv) { 5 | APEX_UNUSED(argc); 6 | APEX_UNUSED(argv); 7 | apex::init("apex::init unit test", 0, 1); 8 | apex::apex_options::use_screen_output(true); 9 | apex::finalize(); 10 | apex::cleanup(); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_openmp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "apex.h" 6 | 7 | #define N 1024*1024 8 | #define MAX_THREADS 256 9 | 10 | #if defined(__GNUC__) 11 | #define ALIGNED_(x) __attribute__ ((aligned(x))) 12 | #else 13 | #define ALIGNED_(x) __declspec(align(x)) 14 | #endif 15 | 16 | double no_sharing(double* x, double* y) 17 | { 18 | double sum=0.0; 19 | ALIGNED_(128) double sum_local[MAX_THREADS] = {0}; 20 | #pragma omp parallel 21 | { 22 | int me = omp_get_thread_num(); 23 | 24 | int i; 25 | #pragma omp for 26 | for (i = 0; i < N; i++) { 27 | sum_local[me] = sum_local[me] + (x[i] * y[i]); 28 | } 29 | 30 | #pragma omp atomic 31 | sum += sum_local[me]; 32 | } 33 | return sum; 34 | } 35 | 36 | void my_init(double* x) 37 | { 38 | double randval = 1.0 + (((double)(rand())) / RAND_MAX); 39 | #pragma omp parallel 40 | { 41 | int i; 42 | #pragma omp for 43 | for (i = 0; i < N; i++) { 44 | x[i] = randval; 45 | } 46 | } 47 | } 48 | 49 | int main(int argc, char** argv) 50 | { 51 | APEX_UNUSED(argc); 52 | APEX_UNUSED(argv); 53 | static double x[N]; 54 | static double y[N]; 55 | printf("Initializing...\n"); fflush(stdout); 56 | my_init(x); 57 | my_init(y); 58 | 59 | double result = 0.0; 60 | 61 | printf("No Sharing...\n"); fflush(stdout); 62 | result = no_sharing(x, y); 63 | printf("Result: %f\n", result); 64 | 65 | apex_finalize(); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_print_options.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | int main (int argc, char** argv) { 10 | APEX_UNUSED(argc); 11 | APEX_UNUSED(argv); 12 | apex_options::use_screen_output(true); 13 | init("apex::print_options unit test", 0, 1); 14 | cout << "APEX Version : " << version() << endl; 15 | apex_options::print_options(); 16 | finalize(); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_register_thread.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | stop(p); 21 | exit_thread(); 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | init("apex::register_thread unit test", 0, 1); 29 | cout << "APEX Version : " << version() << endl; 30 | apex_options::print_options(); 31 | profiler* p = start("main"); 32 | pthread_t thread[2]; 33 | int tid = 0; 34 | pthread_create(&(thread[0]), NULL, someThread, &tid); 35 | int tid2 = 1; 36 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 37 | pthread_join(thread[0], NULL); 38 | pthread_join(thread[1], NULL); 39 | stop(p); 40 | finalize(); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_resume.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | stop(p); 21 | p = resume((apex_function_address)someThread); 22 | stop(p); 23 | exit_thread(); 24 | return NULL; 25 | } 26 | 27 | int main (int argc, char** argv) { 28 | APEX_UNUSED(argc); 29 | APEX_UNUSED(argv); 30 | init("apex::start unit test", 0, 1); 31 | cout << "APEX Version : " << version() << endl; 32 | apex_options::print_options(); 33 | profiler* p = start(__func__); 34 | pthread_t thread[2]; 35 | int tid = 0; 36 | pthread_create(&(thread[0]), NULL, someThread, &tid); 37 | int tid2 = 1; 38 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 39 | pthread_join(thread[0], NULL); 40 | pthread_join(thread[1], NULL); 41 | stop(p); 42 | finalize(); 43 | return 0; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_sample_value.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | stop(p); 21 | exit_thread(); 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | init("apex::sample_value unit test", 0, 1); 29 | cout << "APEX Version : " << version() << endl; 30 | apex_options::print_options(); 31 | profiler* p = start("main"); 32 | pthread_t thread[2]; 33 | int tid = 0; 34 | pthread_create(&(thread[0]), NULL, someThread, &tid); 35 | int tid2 = 1; 36 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 37 | pthread_join(thread[0], NULL); 38 | pthread_join(thread[1], NULL); 39 | stop(p); 40 | finalize(); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_set_state.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | 3 | using namespace apex; 4 | 5 | int main (int argc, char** argv) { 6 | APEX_UNUSED(argc); 7 | APEX_UNUSED(argv); 8 | init("apex_set_state unit test", 0, 1); 9 | apex_options::use_screen_output(true); 10 | set_state(APEX_IDLE); 11 | set_state(APEX_BUSY); 12 | set_state(APEX_THROTTLED); 13 | set_state(APEX_WAITING); 14 | set_state(APEX_BLOCKED); 15 | finalize(); 16 | cleanup(); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_start.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "apex_api.hpp" 5 | 6 | void* someThread(void* tmp) 7 | { 8 | int* tid = (int*)tmp; 9 | char name[32]; 10 | snprintf(name, 32, "worker thread %d", *tid); 11 | /* Register this thread with APEX */ 12 | apex::register_thread(name); 13 | /* Start a timer */ 14 | apex::profiler* p = apex::start("someThread (internal)"); 15 | /* ... */ 16 | /* do some computation */ 17 | /* ... */ 18 | /* stop the timer */ 19 | apex::stop(p); 20 | /* tell APEX that this thread is exiting */ 21 | apex::exit_thread(); 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | /* initialize APEX */ 29 | apex::init("apex::start unit test", 0, 1); 30 | /* start a timer */ 31 | apex::profiler* p = apex::start("main"); 32 | /* Spawn two threads */ 33 | pthread_t thread[2]; 34 | int tid = 0; 35 | pthread_create(&(thread[0]), NULL, someThread, &tid); 36 | int tid2 = 1; 37 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 38 | /* wait for the threads to finish */ 39 | pthread_join(thread[0], NULL); 40 | pthread_join(thread[1], NULL); 41 | /* stop our main timer */ 42 | apex::stop(p); 43 | /* finalize APEX */ 44 | apex::finalize(); 45 | return 0; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_stop.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | stop(p); 21 | exit_thread(); 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | init("apex::stop unit test", 0, 1); 29 | cout << "APEX Version : " << version() << endl; 30 | apex_options::print_options(); 31 | profiler* p = start(__func__); 32 | pthread_t thread[2]; 33 | int tid = 0; 34 | pthread_create(&(thread[0]), NULL, someThread, &tid); 35 | int tid2 = 1; 36 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 37 | pthread_join(thread[0], NULL); 38 | pthread_join(thread[1], NULL); 39 | stop(p); 40 | finalize(); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_swap_threads.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | profiler* swapped_timer = nullptr; 10 | 11 | void* someThread(void* tmp) 12 | { 13 | int* tid = (int*)tmp; 14 | if (*tid == 0) { 15 | swapped_timer = start((apex_function_address)someThread); 16 | printf("Started: %p\n", (void*)swapped_timer); 17 | } 18 | if (*tid == 1) { 19 | printf("Stopping: %p\n", (void*)swapped_timer); 20 | stop(swapped_timer); 21 | } 22 | return NULL; 23 | } 24 | 25 | int main (int argc, char** argv) { 26 | APEX_UNUSED(argc); 27 | APEX_UNUSED(argv); 28 | init("apex::swap thread unit test", 0, 1); 29 | cout << "APEX Version : " << version() << endl; 30 | apex_options::use_screen_output(true); 31 | apex_options::print_options(); 32 | pthread_t thread[2]; 33 | int tid = 0; 34 | pthread_create(&(thread[0]), NULL, someThread, &tid); 35 | pthread_join(thread[0], NULL); 36 | int tid2 = 1; 37 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 38 | pthread_join(thread[1], NULL); 39 | finalize(); 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_throttle_event.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define MAX_OUTER 500 8 | #define MAX_INNER 500 9 | #define MAX_THREADS 8 10 | 11 | uint64_t func(uint64_t i) { 12 | char name[128]; 13 | snprintf(name, 128, "func %lu", i); 14 | apex::profiler* p = apex::start(std::string(name)); 15 | uint64_t j = i * i; 16 | apex::stop(p); 17 | return j; 18 | } 19 | 20 | uint64_t foo(uint64_t i) { 21 | uint64_t j=0; 22 | apex::profiler* p = apex::start((apex_function_address)(&foo)); 23 | for (uint64_t x = 0 ; x < MAX_OUTER ; x++) { 24 | for (uint64_t y = 0 ; y < MAX_INNER ; y++) { 25 | j += func(x) * func(y) + i; 26 | } 27 | } 28 | apex::stop(p); 29 | return j; 30 | } 31 | 32 | int main (int argc, char** argv) { 33 | apex::init("apex_start unit test", 0, 1); 34 | apex::profiler* p = apex::start(__func__); 35 | uint64_t i = 0; 36 | std::thread threads[MAX_THREADS]; 37 | for (i = 0 ; i < MAX_THREADS ; i++) { 38 | //j += foo(i); 39 | threads[i] = std::thread(foo,i); 40 | } 41 | for (i = 0 ; i < MAX_THREADS ; i++) { 42 | threads[i].join(); 43 | } 44 | apex::stop(p); 45 | apex::finalize(); 46 | apex::cleanup(); 47 | return 0; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_version.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | 4 | int main (int argc, char** argv) { 5 | APEX_UNUSED(argc); 6 | APEX_UNUSED(argv); 7 | apex::init("apex::version unit test", 0, 1); 8 | std::cout << apex::version() << std::endl; 9 | apex::finalize(); 10 | apex::cleanup(); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/unit_tests/C++/apex_yield.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | void* someThread(void* tmp) 10 | { 11 | int* tid = (int*)tmp; 12 | char name[32]; 13 | snprintf(name, 32, "worker-thread#%d", *tid); 14 | register_thread(name); 15 | profiler* p = start((apex_function_address)someThread); 16 | sample_value("/threadqueue{locality#0/total}/length", 2.0); 17 | char counter[64]; 18 | snprintf(counter, 64, "/threadqueue{locality#0/%s}/length", name); 19 | sample_value(counter, 2.0); 20 | yield(p); 21 | p = start((apex_function_address)someThread); 22 | stop(p); 23 | exit_thread(); 24 | return NULL; 25 | } 26 | 27 | int main (int argc, char** argv) { 28 | APEX_UNUSED(argc); 29 | APEX_UNUSED(argv); 30 | init("apex::start unit test", 0, 1); 31 | cout << "APEX Version : " << version() << endl; 32 | apex_options::print_options(); 33 | profiler* p = start(__func__); 34 | pthread_t thread[2]; 35 | int tid = 0; 36 | pthread_create(&(thread[0]), NULL, someThread, &tid); 37 | int tid2 = 1; 38 | pthread_create(&(thread[1]), NULL, someThread, &tid2); 39 | pthread_join(thread[0], NULL); 40 | pthread_join(thread[1], NULL); 41 | stop(p); 42 | finalize(); 43 | return 0; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_cleanup.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_cleanup unit test", 0, 1); 7 | apex_set_use_screen_output(1); 8 | //usleep(1000); 9 | apex_finalize(); 10 | apex_cleanup(); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_current_power_high.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "apex.h" 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex_register_thread("threadTest thread"); 16 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | apex_stop(profiler); 24 | apex_exit_thread(); 25 | return NULL; 26 | } 27 | 28 | int main(int argc, char **argv) 29 | { 30 | apex_init("apex_current_power_high unit test", 0, 1); 31 | double currentpower = apex_current_power_high(); 32 | printf("Power at start: %f Watts\n", currentpower); 33 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&main); 34 | pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * NUM_THREADS)); 35 | int i; 36 | for (i = 0 ; i < NUM_THREADS ; i++) { 37 | pthread_create(&(thread[i]), NULL, someThread, NULL); 38 | } 39 | for (i = 0 ; i < NUM_THREADS ; i++) { 40 | pthread_join(thread[i], NULL); 41 | } 42 | apex_stop(profiler); 43 | currentpower = apex_current_power_high(); 44 | printf("Power at start: %f Watts\n", currentpower); 45 | apex_finalize(); 46 | free(thread); 47 | return(0); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_exit_thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "apex.h" 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex_register_thread("threadTest thread"); 16 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | apex_stop(profiler); 24 | apex_exit_thread(); 25 | return NULL; 26 | } 27 | 28 | int main(int argc, char **argv) 29 | { 30 | apex_init("apex_exit_thread unit test", 0, 1); 31 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&main); 32 | pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * NUM_THREADS)); 33 | int i; 34 | for (i = 0 ; i < NUM_THREADS ; i++) { 35 | pthread_create(&(thread[i]), NULL, someThread, NULL); 36 | } 37 | for (i = 0 ; i < NUM_THREADS ; i++) { 38 | pthread_join(thread[i], NULL); 39 | } 40 | apex_stop(profiler); 41 | apex_finalize(); 42 | free(thread); 43 | return(0); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_finalize.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_finalize unit test", 0, 1); 7 | apex_set_use_screen_output(1); 8 | apex_finalize(); 9 | apex_cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_init.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_init unit test", 0, 1); 7 | apex_set_use_screen_output(1); 8 | apex_finalize(); 9 | apex_cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_init_args.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_init_args unit test", 0, 1); 7 | apex_set_use_screen_output(1); 8 | apex_finalize(); 9 | apex_cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_print_options.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 7 | int j = i * i; 8 | apex_stop(profiler); 9 | return j; 10 | } 11 | 12 | int main (int argc, char** argv) { 13 | apex_set_use_screen_output(1); 14 | apex_init("apex_print_options unit test", 0, 1); 15 | printf("APEX Version : %s\n", apex_version()); 16 | apex_print_options(); 17 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 18 | int i,j = 0; 19 | for (i = 0 ; i < 3 ; i++) 20 | j += foo(i); 21 | apex_stop(profiler); 22 | apex_finalize(); 23 | apex_cleanup(); 24 | return 0; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_register_thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "apex.h" 7 | 8 | #define NUM_THREADS 3 9 | 10 | #define UNUSED(x) (void)(x) 11 | 12 | void* someThread(void* tmp) 13 | { 14 | UNUSED(tmp); 15 | apex_register_thread("threadTest thread"); 16 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&someThread); 17 | printf("PID of this process: %d\n", getpid()); 18 | #if defined (__APPLE__) 19 | printf("The ID of this thread is: %lu\n", (unsigned long)pthread_self()); 20 | #else 21 | printf("The ID of this thread is: %u\n", (unsigned int)pthread_self()); 22 | #endif 23 | apex_stop(profiler); 24 | apex_exit_thread(); 25 | return NULL; 26 | } 27 | 28 | int main(int argc, char **argv) 29 | { 30 | apex_init("apex_register_thread unit test", 0, 1); 31 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS,(const void*)&main); 32 | pthread_t * thread = (pthread_t*)(malloc(sizeof(pthread_t) * NUM_THREADS)); 33 | int i; 34 | for (i = 0 ; i < NUM_THREADS ; i++) { 35 | pthread_create(&(thread[i]), NULL, someThread, NULL); 36 | } 37 | for (i = 0 ; i < NUM_THREADS ; i++) { 38 | pthread_join(thread[i], NULL); 39 | } 40 | apex_stop(profiler); 41 | apex_finalize(); 42 | free(thread); 43 | return(0); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_resume.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 7 | int j = i * i; 8 | apex_stop(profiler); 9 | profiler = apex_resume(APEX_FUNCTION_ADDRESS, (const void *)&foo); 10 | int k = j * j; 11 | apex_stop(profiler); 12 | return k; 13 | } 14 | 15 | int main (int argc, char** argv) { 16 | apex_init("apex_resume unit test", 0, 1); 17 | apex_set_use_screen_output(1); 18 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 19 | int i,j = 0; 20 | for (i = 0 ; i < 3 ; i++) 21 | j += foo(i); 22 | apex_stop(profiler); 23 | apex_finalize(); 24 | apex_cleanup(); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_sample_value.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_sample_value unit test", 0, 1); 7 | apex_set_use_screen_output(1); 8 | apex_sample_value("counterA", 1); 9 | apex_sample_value("counterB", 1); 10 | apex_sample_value("counterA", 1); 11 | apex_finalize(); 12 | apex_cleanup(); 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_set_state.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_set_state unit test", 0, 1); 7 | apex_profiler_handle p = apex_start(APEX_NAME_STRING, "main"); 8 | apex_set_use_screen_output(1); 9 | apex_set_state(APEX_IDLE); 10 | apex_set_state(APEX_BUSY); 11 | apex_set_state(APEX_THROTTLED); 12 | apex_set_state(APEX_WAITING); 13 | apex_set_state(APEX_BLOCKED); 14 | apex_stop(p); 15 | apex_finalize(); 16 | apex_cleanup(); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_start.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_NAME_STRING, (void*)__func__); 7 | int j = i * i; 8 | apex_stop(profiler); 9 | return j; 10 | } 11 | 12 | int main (int argc, char** argv) { 13 | apex_init("apex_start unit test", 0, 1); 14 | apex_set_use_screen_output(1); 15 | apex_profiler_handle profiler = apex_start(APEX_NAME_STRING, (void*)__func__); 16 | int i,j = 0; 17 | for (i = 0 ; i < 3 ; i++) 18 | j += foo(i); 19 | apex_stop(profiler); 20 | apex_finalize(); 21 | apex_cleanup(); 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_stop.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 7 | int j = i * i; 8 | apex_stop(profiler); 9 | return j; 10 | } 11 | 12 | int main (int argc, char** argv) { 13 | apex_init("apex_stop unit test", 0, 1); 14 | apex_set_use_screen_output(1); 15 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 16 | int i,j = 0; 17 | for (i = 0 ; i < 3 ; i++) 18 | j += foo(i); 19 | apex_stop(profiler); 20 | apex_finalize(); 21 | apex_cleanup(); 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_throttle_event.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | #define MAX_OUTER 500 6 | #define MAX_INNER 500 7 | 8 | int func(int i) { 9 | char name[128]; 10 | snprintf(name, 128, "func %d", i); 11 | apex_profiler_handle profiler = apex_start(APEX_NAME_STRING, name); 12 | int j = i * i; 13 | apex_stop(profiler); 14 | return j; 15 | } 16 | 17 | uintptr_t foo(uintptr_t i) { 18 | int j = 0; 19 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 20 | int x,y; 21 | for (x = 0 ; x < MAX_OUTER ; x++) { 22 | for (y = 0 ; y < MAX_INNER ; y++) { 23 | j += func(x) * func(y) + i; 24 | } 25 | } 26 | apex_stop(profiler); 27 | return j; 28 | } 29 | 30 | int main (int argc, char** argv) { 31 | apex_init("apex_start unit test", 0, 1); 32 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 33 | int i,j = 0; 34 | for (i = 0 ; i < 3 ; i++) { 35 | j += foo(i); 36 | } 37 | apex_stop(profiler); 38 | apex_finalize(); 39 | apex_cleanup(); 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_version.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int main (int argc, char** argv) { 6 | apex_init("apex_version unit test", 0, 1); 7 | printf("APEX Version : %s\n", apex_version()); 8 | apex_finalize(); 9 | apex_cleanup(); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/unit_tests/C/apex_yield.c: -------------------------------------------------------------------------------- 1 | #include "apex.h" 2 | #include 3 | #include 4 | 5 | int foo(int i) { 6 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 7 | int j = i * i; 8 | apex_yield(profiler); 9 | profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&foo); 10 | int k = j * j; 11 | apex_stop(profiler); 12 | return k; 13 | } 14 | 15 | int main (int argc, char** argv) { 16 | apex_init("apex_yield unit test", 0, 1); 17 | apex_set_use_screen_output(1); 18 | apex_profiler_handle profiler = apex_start(APEX_FUNCTION_ADDRESS, (const void *)&main); 19 | int i,j = 0; 20 | for (i = 0 ; i < 3 ; i++) 21 | j += foo(i); 22 | apex_stop(profiler); 23 | apex_finalize(); 24 | apex_cleanup(); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/unit_tests/CUDA/allocation.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "allocation.hpp" 4 | #include 5 | float** alloc_2d_init(int r, int c) 6 | { 7 | float** A = new float*[r]; 8 | A[0] = new float[r*c]; 9 | for (int i = 1; i < r; ++i) 10 | A[i] = A[i-1] + c; 11 | return A; 12 | } 13 | 14 | void data_init(float** A, int r, int c) 15 | { 16 | for(int i=0; i 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | // includes, timer, string parsing, image helpers 34 | #include // helper functions for timers 35 | #include // helper functions for string parsing 36 | #include // helper functions for image compare, dump, data comparisons 37 | 38 | #endif // HELPER_FUNCTIONS_H 39 | -------------------------------------------------------------------------------- /src/unit_tests/CUDA/timer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // #include "tsc_x86.h" 4 | #include 5 | 6 | namespace { 7 | std::chrono::high_resolution_clock::time_point __start_time; 8 | // unsigned long long int __start_cycles; 9 | } 10 | 11 | void startTimer() { __start_time = std::chrono::high_resolution_clock::now(); } 12 | 13 | // void startCycles() { __start_cycles = start_tsc(); } 14 | 15 | double endTimer() { 16 | auto end = std::chrono::high_resolution_clock::now(); 17 | auto time_span = std::chrono::duration_cast>( 18 | end - __start_time); 19 | return time_span.count(); 20 | } 21 | 22 | // auto endCycles() { return stop_tsc(__start_cycles); } -------------------------------------------------------------------------------- /src/unit_tests/CUDA/util_cuda.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | extern "C" void alloc_d(long long N, float** buff); 8 | 9 | extern "C" void alloc_d_char(long long N, char** buff); 10 | 11 | extern "C" void free_d(char* buff); 12 | 13 | extern "C" void init_d(long long N, char* buff, char c); 14 | 15 | // Prints an error message containing error, function_name, file_name, line and extra_error_string. 16 | void printErrorMessage(std::string error, std::string function_name, std::string file_name, 17 | int line, std::string extra_error_string = ""); 18 | 19 | void generateG2(float* G2, int rank, size_t n_elems); 20 | 21 | void update_local_G4(float* G2, float* G4, int rank, size_t n_elems); 22 | 23 | void print_helper(float* G4, int index); 24 | 25 | template 26 | T* allocate_on_device(std::size_t n) { 27 | if (n == 0) 28 | return nullptr; 29 | T* ptr; 30 | cudaError_t ret = cudaMalloc((void**)&ptr, n * sizeof(T)); 31 | if (ret != cudaSuccess) { 32 | printErrorMessage(std::string(cudaGetErrorString(ret)), __FUNCTION__, __FILE__, __LINE__, 33 | "\t DEVICE size requested : " + std::to_string(n * sizeof(T))); 34 | throw(std::bad_alloc()); 35 | } 36 | return ptr; 37 | } 38 | 39 | template 40 | void CudaMemoryCopy(T* dest, T* src, size_t size) { 41 | cudaError_t ret = cudaMemcpy(dest, src, size * sizeof(T), cudaMemcpyDeviceToDevice); 42 | if (ret != cudaSuccess) { 43 | printErrorMessage(std::string(cudaGetErrorString(ret)), __FUNCTION__, __FILE__, __LINE__, "\t cuda mem copy failed " ); 44 | throw std::logic_error(__FUNCTION__); 45 | } 46 | } -------------------------------------------------------------------------------- /src/unit_tests/CUDA/util_mpi.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wei, Weile on 10/31/19. 3 | // 4 | 5 | #ifndef MPI_CUDA_UTIL_MPI_HPP 6 | #define MPI_CUDA_UTIL_MPI_HPP 7 | 8 | #include 9 | 10 | #define MPI_CHECK(stmt) \ 11 | do { \ 12 | int mpi_errno = (stmt); \ 13 | if (MPI_SUCCESS != mpi_errno) { \ 14 | fprintf(stderr, "[%s:%d] MPI call failed with %d \n", \ 15 | __FILE__, __LINE__,mpi_errno); \ 16 | exit(EXIT_FAILURE); \ 17 | } \ 18 | assert(MPI_SUCCESS == mpi_errno); \ 19 | } while (0) 20 | 21 | #endif //MPI_CUDA_UTIL_MPI_HPP -------------------------------------------------------------------------------- /src/unit_tests/Kokkos/simple.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #ifndef EXECUTION_SPACE 8 | #define EXECUTION_SPACE DefaultHostExecutionSpace 9 | #endif 10 | 11 | void go(size_t i) { 12 | int n = 512; 13 | Kokkos::View a("a",n); 14 | Kokkos::View b("b",n); 15 | Kokkos::View c("c",n); 16 | 17 | auto range = Kokkos::RangePolicy(0,n); 18 | 19 | Kokkos::parallel_for( 20 | "initialize", range, KOKKOS_LAMBDA(size_t const i) { 21 | auto x = static_cast(i); 22 | a(i) = sin(x) * sin(x); 23 | b(i) = cos(x) * cos(x); 24 | } 25 | ); 26 | 27 | Kokkos::parallel_for( 28 | "xpy", range, KOKKOS_LAMBDA(size_t const i) { 29 | c(i) = a(i) + b(i); 30 | } 31 | ); 32 | 33 | double sum = 0.0; 34 | 35 | Kokkos::parallel_reduce( 36 | "sum", range, KOKKOS_LAMBDA(size_t const i, double &lsum) { 37 | lsum += c(i); 38 | }, sum 39 | ); 40 | 41 | if (i % 10 == 0) { 42 | std::cout << "sum = " << sum / n << std::endl; 43 | } 44 | } 45 | 46 | int main(int argc, char *argv[]) { 47 | Kokkos::initialize(argc, argv); 48 | std::cout << "Kokkos execution space: " 49 | << Kokkos::DefaultExecutionSpace::name() << std::endl; 50 | for (size_t i = 0 ; i < 10 ; i++) { 51 | go(i); 52 | } 53 | Kokkos::finalize(); 54 | } -------------------------------------------------------------------------------- /src/unit_tests/MPI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 3 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${MPI_CXX_INCLUDE_PATH}) 4 | 5 | # Make sure the linker can find the Apex library once it is built. 6 | link_directories (${APEX_BINARY_DIR}/src/apex) 7 | 8 | # Add executable called "mpi_test" that is built from the source file 9 | # "mpi_cpi.c". The extensions are automatically found. 10 | add_executable (mpi_cpi mpi_cpi.c) 11 | add_dependencies (mpi_cpi apex) 12 | add_executable (mpi_divergent mpi_divergent.c) 13 | add_dependencies (mpi_divergent apex) 14 | add_dependencies (tests mpi_cpi mpi_divergent) 15 | 16 | # Link the executable to the Apex library. 17 | target_link_libraries (mpi_cpi apex apex_mpi ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 18 | target_link_libraries (mpi_divergent apex apex_mpi ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} ${LIBS} ${APEX_STDCXX_LIB} m) 19 | if (BUILD_STATIC_EXECUTABLES) 20 | set_target_properties(mpi_cpi PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 21 | set_target_properties(mpi_divergent PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 22 | endif() 23 | 24 | INSTALL(TARGETS mpi_cpi mpi_divergent 25 | RUNTIME DESTINATION bin OPTIONAL 26 | ) 27 | -------------------------------------------------------------------------------- /src/unit_tests/opencl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | #link_directories (${APEX_BINARY_DIR}/src/apex_pthread_wrapper) 7 | 8 | if(OpenCL_FOUND) 9 | 10 | set(example_programs 11 | opencl_matmult 12 | ) 13 | 14 | foreach(example_program ${example_programs}) 15 | set(sources ${example_program}.cpp) 16 | source_group("Source Files" FILES ${sources}) 17 | add_executable("${example_program}_cpp" ${sources}) 18 | target_link_libraries ("${example_program}_cpp" apex ${LIBS} OpenCL::OpenCL) 19 | # This is needed to make sure local symbols are exported and we can dladdr them 20 | set_property(TARGET "${example_program}_cpp" PROPERTY ENABLE_EXPORTS ON) 21 | add_dependencies ("${example_program}_cpp" apex) 22 | add_dependencies (tests "${example_program}_cpp") 23 | add_test ("test_${example_program}_cpp" "${example_program}_cpp") 24 | set_tests_properties("test_${example_program}_cpp" PROPERTIES TIMEOUT 30) 25 | endforeach() 26 | 27 | # Make sure the compiler can find include files from our Apex library. 28 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") 29 | include_directories (. ${APEX_SOURCE_DIR}/src/apex ${MPI_CXX_INCLUDE_PATH}) 30 | 31 | # Make sure the linker can find the Apex library once it is built. 32 | link_directories (${APEX_BINARY_DIR}/src/apex) 33 | 34 | endif(OpenCL_FOUND) 35 | -------------------------------------------------------------------------------- /src/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex) 3 | 4 | # Make sure the linker can find the Apex library once it is built. 5 | link_directories (${APEX_BINARY_DIR}/src/apex) 6 | #link_directories (${APEX_BINARY_DIR}/src/apex_pthread_wrapper) 7 | 8 | set(util_programs 9 | apex_make_default_config 10 | apex_environment_help 11 | apex_header 12 | ) 13 | 14 | foreach(util_program ${util_programs}) 15 | set(sources ${util_program}.cpp) 16 | source_group("Source Files" FILES ${sources}) 17 | add_executable("${util_program}" ${sources}) 18 | target_link_libraries ("${util_program}" apex ${LIBS} ${APEX_STDCXX_LIB}) 19 | if (BUILD_STATIC_EXECUTABLES) 20 | set_target_properties("${util_program}" PROPERTIES LINK_SEARCH_START_STATIC 1 LINK_SEARCH_END_STATIC 1) 21 | endif() 22 | add_dependencies ("${util_program}" apex) 23 | install(TARGETS "${util_program}" RUNTIME DESTINATION "bin" OPTIONAL) 24 | endforeach() 25 | 26 | -------------------------------------------------------------------------------- /src/utils/apex_environment_help.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | int main (int argc, char** argv) { 10 | APEX_UNUSED(argc); 11 | APEX_UNUSED(argv); 12 | init("apex_environment_help", 0, 1); 13 | apex_options::environment_help(); 14 | finalize(); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/utils/apex_header.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | int main (int argc, char** argv) { 10 | APEX_UNUSED(argc); 11 | APEX_UNUSED(argv); 12 | init("apex_header", 0, 1); 13 | finalize(); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/utils/apex_make_default_config.cpp: -------------------------------------------------------------------------------- 1 | #include "apex_api.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace apex; 7 | using namespace std; 8 | 9 | int main (int argc, char** argv) { 10 | APEX_UNUSED(argc); 11 | APEX_UNUSED(argv); 12 | init("apex_make_default_config", 0, 1); 13 | apex_options::make_default_config(); 14 | finalize(); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/wrappers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make sure the compiler can find include files from our Apex library. 2 | include_directories (${APEX_SOURCE_DIR}/src/apex 3 | ${APEX_SOURCE_DIR}/src/wrappers) 4 | # add the binary tree to the search path for include files 5 | # so that we will find ApexConfig.h 6 | include_directories("${PROJECT_BINARY_DIR}/src/apex") 7 | 8 | # Make sure the linker can find the Apex library once it is built. 9 | link_directories (${APEX_BINARY_DIR}/src/apex) 10 | 11 | # Add library called "apex_pthread_wrapper" that is built from the source file 12 | add_library (apex_pthread_wrapper pthread_wrapper.c pthread_wrapper_internal.cpp) 13 | add_dependencies (apex_pthread_wrapper apex) 14 | target_link_libraries (apex_pthread_wrapper apex) 15 | 16 | # Add library called "apex_memory_wrapper" that is built from the source file 17 | add_library (apex_memory_wrapper memory_wrapper.cpp memory_wrapper_internal.cpp) 18 | add_dependencies (apex_memory_wrapper apex) 19 | target_link_libraries (apex_memory_wrapper apex) 20 | 21 | if(NOT APPLE) 22 | # Add library called "apex_dl_auditor" that is built from the source file 23 | #add_library (apex_dl_auditor dl_auditor.c) 24 | #target_link_libraries (apex_dl_auditor dl) 25 | #INSTALL(TARGETS apex_pthread_wrapper apex_memory_wrapper apex_dl_auditor 26 | INSTALL(TARGETS apex_pthread_wrapper apex_memory_wrapper 27 | RUNTIME DESTINATION bin 28 | LIBRARY DESTINATION lib 29 | ARCHIVE DESTINATION lib 30 | ) 31 | else(NOT APPLE) 32 | INSTALL(TARGETS apex_pthread_wrapper apex_memory_wrapper 33 | RUNTIME DESTINATION bin 34 | LIBRARY DESTINATION lib 35 | ARCHIVE DESTINATION lib 36 | ) 37 | endif(NOT APPLE) 38 | -------------------------------------------------------------------------------- /src/wrappers/dl_auditor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #define _GNU_SOURCE 10 | #include 11 | #include 12 | #include 13 | 14 | int * objopen_counter() 15 | { 16 | static int count = 0; 17 | return &count; 18 | } 19 | 20 | // This auditor supports all API versions. 21 | unsigned int la_version(unsigned int version) 22 | { 23 | return version; 24 | } 25 | 26 | unsigned int la_objopen(struct link_map *map, Lmid_t lmid, uintptr_t *cookie) 27 | { 28 | (*objopen_counter())++; 29 | return 0; 30 | } 31 | 32 | void la_preinit(uintptr_t *cookie) 33 | { 34 | typedef void (*apex_memory_dl_initialized_t)(); 35 | static apex_memory_dl_initialized_t apex_memory_dl_initialized = NULL; 36 | void * memory_so; 37 | 38 | #if defined(__APPLE__) 39 | memory_so = dlmopen(LM_ID_BASE, "libapex_memory_wrapper.dylib", RTLD_NOW); 40 | #else 41 | memory_so = dlmopen(LM_ID_BASE, "libapex_memory_wrapper.so", RTLD_NOW); 42 | #endif 43 | 44 | if (memory_so) { 45 | char const * err; 46 | 47 | dlerror(); // reset error flag 48 | apex_memory_dl_initialized = 49 | (apex_memory_dl_initialized_t)dlsym(memory_so, 50 | "apex_memory_dl_initialized"); 51 | // Check for errors 52 | if ((err = dlerror())) { 53 | printf("APEX: ERROR obtaining symbol info in auditor: %s\n", err); 54 | } else { 55 | apex_memory_dl_initialized(); 56 | } 57 | dlclose(memory_so); 58 | } else { 59 | printf("APEX: ERROR in opening APEX library in auditor.\n"); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/wrappers/pthread_wrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2021 Kevin Huck 3 | * Copyright (c) 2014-2021 University of Oregon 4 | * 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | #ifndef _GNU_SOURCE 10 | #define _GNU_SOURCE 11 | #endif 12 | 13 | #include 14 | 15 | #if !defined(__APPLE__) 16 | #define APEX_PTHREAD_BARRIER_AVAILABLE 17 | #endif 18 | 19 | typedef void * (*start_routine_p)(void *); 20 | typedef int (*pthread_create_p)(pthread_t *, const pthread_attr_t *, start_routine_p, void *arg); 21 | typedef int (*pthread_join_p)(pthread_t, void **); 22 | typedef int (*pthread_detach_p)(pthread_t); 23 | #if 0 24 | typedef void (*pthread_exit_p)(void *); 25 | #if defined(APEX_PTHREAD_BARRIER_AVAILABLE) 26 | typedef int (*pthread_barrier_wait_p)(pthread_barrier_t *); 27 | #endif 28 | #endif 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | int apex_pthread_create_wrapper(pthread_create_p pthread_create_call, 35 | pthread_t * threadp, const pthread_attr_t * attr, start_routine_p, void * arg); 36 | int apex_pthread_join_wrapper(pthread_join_p pthread_join_call, pthread_t thread, void **retval); 37 | int apex_pthread_detach_wrapper(pthread_detach_p pthread_detach_call, pthread_t thread); 38 | #if 0 39 | void apex_pthread_exit_wrapper(pthread_exit_p pthread_exit_call, void * value_ptr); 40 | #if defined(APEX_PTHREAD_BARRIER_AVAILABLE) 41 | int apex_pthread_barrier_wait_wrapper(pthread_barrier_wait_p pthread_barrier_wait_call, 42 | pthread_barrier_t * barrier); 43 | #endif 44 | #endif 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #define APEX_PRELOAD_LIB 51 | --------------------------------------------------------------------------------