Skip to content

Commit 34cee13

Browse files
committed
prefix phasta macros with PUMI_and update ph cmake
- phasta/CMakeLists.txt: add PUMI_ prefix to cmake variables and macros. - remove add_definitions and change INTERFACE to PUBLIC. - the effect of doing add_definitions and then adding INTERFACE definitions is the same as adding PRIVATE and then INTERFACE. adding both PRIVATE and INTERFACE is the same as PUBLIC. - phasta/phiotimer.h, phasta/phiotimer.cc: use PUMI_ prefixed macros. Signed-off-by: Aiden Woodruff <woodra@rpi.edu>
1 parent 8dbb749 commit 34cee13

3 files changed

Lines changed: 14 additions & 18 deletions

File tree

phasta/CMakeLists.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,21 @@ add_library(ph ${SOURCES})
7272

7373
#determine which timer to use based on the target system and compiler
7474
if(CMAKE_SYSTEM_NAME MATCHES BlueGeneQ*)
75-
add_definitions(-DUSE_PCU_TIME)
76-
target_compile_definitions(ph INTERFACE -DUSE_PCU_TIME)
75+
target_compile_definitions(ph PUBLIC -DPUMI_USE_PCU_TIME)
7776
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
78-
add_definitions(-DHAVE_INTEL_RDTSC)
79-
target_compile_definitions(ph INTERFACE -DHAVE_INTEL_RDTSC)
77+
target_compile_definitions(ph PUBLIC -DPUMI_HAVE_INTEL_RDTSC)
8078
else()
8179
#from https://github.com/abduld/libwb/issues/5
8280
include(CheckFunctionExists)
83-
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
84-
if(NOT HAVE_CLOCK_GETTIME)
81+
CHECK_FUNCTION_EXISTS(clock_gettime PUMI_HAVE_CLOCK_GETTIME)
82+
if(NOT PUMI_HAVE_CLOCK_GETTIME)
8583
find_library(LIBRT_LIBRARIES rt)
8684
message(STATUS "librt: ${LIBRT_LIBRARIES}")
87-
endif(NOT HAVE_CLOCK_GETTIME)
88-
if( HAVE_CLOCK_GETTIME OR LIBRT_LIBRARIES )
89-
add_definitions(-DHAVE_CLOCK_GETTIME)
90-
target_compile_definitions(ph INTERFACE -DHAVE_CLOCK_GETTIME)
85+
endif(NOT PUMI_HAVE_CLOCK_GETTIME)
86+
if( PUMI_HAVE_CLOCK_GETTIME OR LIBRT_LIBRARIES )
87+
target_compile_definitions(ph PUBLIC -DPUMI_HAVE_CLOCK_GETTIME)
9188
else()
92-
add_definitions(-DUSE_PCU_TIME)
93-
target_compile_definitions(ph INTERFACE -DUSE_PCU_TIME)
89+
target_compile_definitions(ph PUBLIC -DPUMI_USE_PCU_TIME)
9490
endif()
9591
endif()
9692

phasta/phiotimer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct phastaio_stats {
2727
};
2828
static struct phastaio_stats phastaio_global_stats;
2929

30-
#if defined(HAVE_INTEL_RDTSC)
30+
#if defined(PUMI_HAVE_INTEL_RDTSC)
3131
/* return the cycle count */
3232
void phastaio_time(phastaioTime* t) {
3333
*t = _rdtsc(); //intel intrinsic
@@ -60,7 +60,7 @@ size_t phastaio_time_diff(phastaioTime* start, phastaioTime* end) {
6060
size_t us = ((double)cycles)/phastaio_global_stats.cpus;
6161
return us;
6262
}
63-
#elif defined(USE_PCU_TIME)
63+
#elif defined(PUMI_USE_PCU_TIME)
6464
void phastaio_time(phastaioTime* t) {
6565
*t = pcu::Time();
6666
}
@@ -69,7 +69,7 @@ size_t phastaio_time_diff(phastaioTime* start, phastaioTime* end) {
6969
size_t elapsed = static_cast<size_t>((*end-*start)*MILLION);
7070
return elapsed;
7171
}
72-
#elif defined(HAVE_CLOCK_GETTIME)
72+
#elif defined(PUMI_HAVE_CLOCK_GETTIME)
7373
void phastaio_time(phastaioTime* t) {
7474
int err;
7575
err = clock_gettime(CLOCK_MONOTONIC,t);

phasta/phiotimer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ enum phastaio_file {
5959
NUM_PHASTAIO_MODES
6060
};
6161

62-
#if defined(HAVE_INTEL_RDTSC)
62+
#if defined(PUMI_HAVE_INTEL_RDTSC)
6363
typedef size_t phastaioTime;
64-
#elif defined(USE_PCU_TIME)
64+
#elif defined(PUMI_USE_PCU_TIME)
6565
typedef double phastaioTime;
66-
#elif defined(HAVE_CLOCK_GETTIME)
66+
#elif defined(PUMI_HAVE_CLOCK_GETTIME)
6767
#include <time.h>
6868
typedef struct timespec phastaioTime;
6969
#endif

0 commit comments

Comments
 (0)