Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Mar 20, 2020
2 parents bd9abef + b31729d commit fa316a6
Show file tree
Hide file tree
Showing 15 changed files with 285 additions and 110 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ build_*
test
doc/webdocs/site
install*
rapidjson
*.swp
regression*
*.sh
*DS_Store
concurrentqueue
perfstubs
rapidjson
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ include(GitExternal)
git_external(concurrentqueue
https://github.com/cameron314/concurrentqueue.git
master
VERBOSE)
VERBOSE NO_UPDATE)

find_file(
CONCURRENTQUEUE_HEADER
Expand All @@ -677,12 +677,12 @@ git_external(perfstubs

find_file(
PERFSTUBS_HEADER
NAMES perfstubs_api/Tool.h
NAMES perfstubs_api/tool.h
PATHS ${PROJECT_SOURCE_DIR}/perfstubs)

if(PERFSTUBS_HEADER)
message(INFO " Found perfstubs at ${PROJECT_SOURCE_DIR}/perfstubs")
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/perfstubs)
else()
message(FATAL_ERROR " perfstubs not found. This should have been checked out automatically. "
"Try manually check out https://github.com/khuck/perfstubs.git to ${PROJECT_SOURCE_DIR}")
Expand Down Expand Up @@ -817,7 +817,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pkgconfig/apex.pc.in
${CMAKE_BINARY_DIR}/pkgconfig/apex.pc @ONLY)
INSTALL_FILES(/lib/pkgconfig FILES pkgconfig/apex.pc)

if (APEX_USE_WEAK_SYMBOLS)
if (APEX_USE_WEAK_SYMBOLS)
add_definitions(-DAPEX_USE_WEAK_SYMBOLS)
else()
find_library(DYNAMICLIB dl)
Expand Down
28 changes: 14 additions & 14 deletions cmake/Modules/GitExternal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#
# [optional] Flags which control behaviour
# NO_UPDATE
# When set, GitExternal will not change a repo that has already been checked out.
# The purpose of this is to allow one to set a default branch to be checked out,
# but stop GitExternal from changing back to that branch if the user has checked
# When set, GitExternal will not change a repo that has already been checked out.
# The purpose of this is to allow one to set a default branch to be checked out,
# but stop GitExternal from changing back to that branch if the user has checked
# out and is working on another.
# VERBOSE
# When set, displays information about git commands that are executed
# VERBOSE
# When set, displays information about git commands that are executed
#

find_package(Git)
Expand Down Expand Up @@ -101,15 +101,15 @@ function(GIT_EXTERNAL DIR REPO TAG)
endif()

# update tag
# GIT_EXTERNAL_MESSAGE("git rebase FETCH_HEAD")
# execute_process(COMMAND ${GIT_EXECUTABLE} rebase FETCH_HEAD
# RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE OUTPUT
# WORKING_DIRECTORY "${DIR}")
# if(RESULT)
# message(STATUS "git rebase failed, aborting ${DIR} merge")
# execute_process(COMMAND ${GIT_EXECUTABLE} rebase --abort
# WORKING_DIRECTORY "${DIR}")
# endif()
GIT_EXTERNAL_MESSAGE("git rebase FETCH_HEAD")
execute_process(COMMAND ${GIT_EXECUTABLE} rebase FETCH_HEAD
RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE OUTPUT
WORKING_DIRECTORY "${DIR}")
if(RESULT)
message(STATUS "git rebase failed, aborting ${DIR} merge")
execute_process(COMMAND ${GIT_EXECUTABLE} rebase --abort
WORKING_DIRECTORY "${DIR}")
endif()

endif()
else()
Expand Down
2 changes: 1 addition & 1 deletion etc/buildbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ yes_otf=" -DUSE_OTF2=TRUE -DOTF2_ROOT=/usr/local/otf2/2.1"
yes_ompt=" -DUSE_OMPT=TRUE -DOMPT_ROOT=/usr/local/ompt/5.0"
#yes_mpi=" -DUSE_MPI=TRUE -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx"
yes_mpi=" -DUSE_MPI=TRUE"
yes_papi=" -DUSE_PAPI=TRUE -DPAPI_ROOT=/usr/local/papi/5.5.0"
yes_papi=" -DUSE_PAPI=TRUE -DPAPI_ROOT=/usr"
yes_tau=" -DUSE_TAU=TRUE -DTAU_ROOT=/usr/local/tau/git -DTAU_ARCH=x86_64 -DTAU_OPTIONS=-pthread"

# set defaults
Expand Down
8 changes: 4 additions & 4 deletions src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,16 +1818,16 @@ using namespace apex;

extern "C" {

int apex_init(const char * thread_name, unsigned long int comm_rank,
unsigned long int comm_size) {
int apex_init(const char * thread_name, const uint64_t comm_rank,
const uint64_t comm_size) {
return init(thread_name, comm_rank, comm_size);
}

int apex_init_(unsigned long int comm_rank, unsigned long int comm_size) {
int apex_init_(const uint64_t comm_rank, const uint64_t comm_size) {
return init("FORTRAN thread", comm_rank, comm_size);
}

int apex_init__(unsigned long int comm_rank, unsigned long int comm_size) {
int apex_init__(const uint64_t comm_rank, const uint64_t comm_size) {
return init("FORTRAN thread", comm_rank, comm_size);
}

Expand Down
5 changes: 3 additions & 2 deletions src/apex/apex.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "apex_types.h"
#include "apex_export.h"
#include "stdbool.h"
#include "stdint.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -53,8 +54,8 @@ extern "C" {
\return APEX_NOERROR on success, or APEX_ERROR on failure.
\sa @ref apex_finalize
*/
APEX_EXPORT int apex_init(const char * thread_name, const unsigned int
comm_rank, const unsigned int comm_size);
APEX_EXPORT int apex_init(const char * thread_name, const uint64_t comm_rank,
const uint64_t comm_size);

/**
\brief Dump output from APEX.
Expand Down
1 change: 1 addition & 0 deletions src/apex/apex_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ typedef struct _profile
double maximum; /*!< Maximum value seen by the timer or counter */
apex_profile_type type; /*!< Whether this is a timer or a counter */
double papi_metrics[8]; /*!< Array of accumulated PAPI hardware metrics */
int times_reset; /*!< How many times was this timer reset */
} apex_profile;

/** Rather than use void pointers everywhere, be explicit about
Expand Down
46 changes: 23 additions & 23 deletions src/apex/perftool_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include "perfstubs/perfstubs_api/Tool.h"
#include "perfstubs_api/tool.h"
#include <stdlib.h>
#include "apex.h"
#include "thread_instance.hpp"
Expand All @@ -15,54 +15,54 @@ std::mutex my_mutex;

extern "C" {
// library function declarations
void perftool_init(void) {
void ps_initialize(void) {
apex_init("PerfStubs API", 0, 1);
}
void perftool_register_thread(void) {
void ps_register_thread(void) {
apex_register_thread("PerfStubs Thread");
}
void perftool_exit(void) {
void ps_finalize(void) {
apex_exit_thread();
}
void perftool_dump(void) {
void ps_dump_data(void) {
apex_dump(false);
}

// measurement function declarations
void* perftool_timer_create(const char *timer_name) {
void* ps_timer_create(const char *timer_name) {
return strdup(timer_name);
}
void perftool_timer_start(const void *timer) {
void ps_timer_start(const void *timer) {
apex_start(APEX_NAME_STRING, const_cast<void*>(timer));
}
void perftool_timer_stop(const void *timer) {
void ps_timer_stop(const void *timer) {
apex_stop(apex::thread_instance::instance().get_current_profiler());
}
void perftool_dynamic_phase_start(const char *iteration_prefix,
void ps_dynamic_phase_start(const char *iteration_prefix,
int iteration_number) {
std::stringstream ss;
ss << iteration_prefix << " " << iteration_number;
apex_start(APEX_NAME_STRING, (void*)const_cast<char*>(ss.str().c_str()));
}
void perftool_dynamic_phase_stop(const char *iteration_prefix,
void ps_dynamic_phase_stop(const char *iteration_prefix,
int iteration_number) {
apex_stop(apex::thread_instance::instance().get_current_profiler());
}
void* perftool_create_counter(const char *counter_name) {
void* ps_create_counter(const char *counter_name) {
return (void*)(strdup(counter_name));
}
void perftool_sample_counter(const void *counter, double value) {
void ps_sample_counter(const void *counter, double value) {
apex_sample_value((const char *)(counter), value);
}
void perftool_metadata(const char *name, const char *value) {
void ps_set_metadata(const char *name, const char *value) {
// do nothing
}

// data query function declarations
void perftool_get_timer_data(perftool_timer_data_t *timer_data) {
memset(timer_data, 0, sizeof(perftool_timer_data_t));
void ps_get_timer_data(ps_tool_timer_data_t *timer_data) {
memset(timer_data, 0, sizeof(ps_tool_timer_data_t));
}
void perftool_free_timer_data(perftool_timer_data_t *timer_data) {
void ps_free_timer_data(ps_tool_timer_data_t *timer_data) {
if (timer_data == nullptr)
{
return;
Expand All @@ -83,12 +83,12 @@ extern "C" {
timer_data->values = nullptr;
}
}
void perftool_get_counter_data(perftool_counter_data_t *counter_data) {
memset(counter_data, 0, sizeof(perftool_counter_data_t));
void ps_get_counter_data(ps_tool_counter_data_t *counter_data) {
memset(counter_data, 0, sizeof(ps_tool_counter_data_t));
}
void perftool_free_counter_data(perftool_counter_data_t *counter_data) {
void ps_free_counter_data(ps_tool_counter_data_t *counter_data) {
if (counter_data == nullptr)
{
{
return;
}
if (counter_data->counter_names != nullptr)
Expand Down Expand Up @@ -122,10 +122,10 @@ extern "C" {
counter_data->value_sumsqr = nullptr;
}
}
void perftool_get_metadata(perftool_metadata_t *metadata) {
memset(metadata, 0, sizeof(perftool_metadata_t));
void ps_get_metadata(ps_tool_metadata_t *metadata) {
memset(metadata, 0, sizeof(ps_tool_metadata_t));
}
void perftool_free_metadata(perftool_metadata_t *metadata) {
void ps_free_metadata(ps_tool_metadata_t *metadata) {
if (metadata == nullptr)
{
return;
Expand Down
2 changes: 2 additions & 0 deletions src/apex/profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ class profile {
_profile.sum_squares = 0.0;
_profile.minimum = 0.0;
_profile.maximum = 0.0;
_profile.times_reset++;
};
double get_calls() { return _profile.calls; }
double get_mean() { return (_profile.accumulated / _profile.calls); }
double get_accumulated() { return (_profile.accumulated); }
double * get_papi_metrics() { return (_profile.papi_metrics); }
double get_minimum() { return (_profile.minimum); }
double get_maximum() { return (_profile.maximum); }
int get_times_reset() { return (_profile.times_reset); }
double get_variance() {
double mean = get_mean();
double variance = ((_profile.sum_squares / _profile.calls) - (mean * mean));
Expand Down
Loading

0 comments on commit fa316a6

Please sign in to comment.