Skip to content

Commit

Permalink
Fixed several issues preventing tau from building with VS on Windows.
Browse files Browse the repository at this point in the history
Former-commit-id: cb6ed73771bfd70897c2bd72f653ffbc3f0c2d07
  • Loading branch information
wspear committed Jan 3, 2022
1 parent a0ef293 commit a57aa96
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Makefile.win32
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
MPICFLAGS= /O2 /Gz /nologo /EHsc -I . -DPROFILING_ON -DTAU_WINDOWS
CFLAGS= $(CFLAGS) /O2 /Gd /nologo /TP /EHsc -I .
CC=cl
INCLUDES=-Iinclude -I../include -Iinclude/Profile -I"C:\Program Files\Microsoft Compute Cluster Pack\Include"
INCLUDES=-I./include -I../include -I./include/Profile -I"C:\Program Files\Microsoft Compute Cluster Pack\Include"
DEFINES=-DTAU_WINDOWS -DTAU_DOT_H_LESS_HEADERS -DTAU_LIBRARY_SOURCE -DTAU_DISABLE_SIGUSR -DTAU_SYNCHRONIZE_CLOCKS -DPDT_NO_UPC
#DEFINES=-DTAU_WINDOWS -DTAU_DOT_H_LESS_HEADERS -DTAU_LIBRARY_SOURCE -DTAU_DISABLE_SIGUSR -DTAU_MPI -DTAU_SYNCHRONIZE_CLOCKS
CFLAGS=$(CFLAGS) $(DEFINES) $(INCLUDES)
Expand Down Expand Up @@ -55,7 +55,8 @@ src/Profile/TauXML.cpp \
src/Profile/Tracer.cpp \
src/Profile/UserEvent.cpp \
src/Profile/TauMmapMemMgr.cpp \
src/Profile/WindowsThreadLayer.cpp
src/Profile/WindowsThreadLayer.cpp \
src/Profile/TauBfdUnimplemented.cpp

#TAU_PROFILE_SRCS= src\Profile\TauInit.cpp src\Profile\TauEnv.cpp src\profile\TauCallPath.cpp src\profile\FunctionInfo.cpp src\profile\Profiler.cpp src\profile\RtsLayer.cpp src\profile\RtsThread.cpp src\profile\TauCAPI.cpp src\profile\TauFAPI.cpp src\profile\TauHandler.cpp src\profile\TauHooks.cpp src\profile\TauMapping.cpp src\profile\TauMemory.cpp src\profile\UserEvent.cpp src\profile\WindowsThreadLayer.cpp src\profile\TauMetaData.cpp src\profile\TauMetrics.cpp src\profile\TauReadMetrics.cpp src\profile\Tracer.cpp src\profile\TauCompensate.cpp
TAU_JAVA_SRC= src\profile\JavaThreadLayer.cpp src\profile\TauJava.cpp src\profile\TauJAPI.cpp src\profile\MetaData.cpp
Expand Down
2 changes: 2 additions & 0 deletions include/Profile/TauEnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ extern "C" {
const char* TAUDECL TauEnv_get_plugins();
int TAUDECL TauEnv_get_plugins_enabled();
int TAUDECL TauEnv_get_track_mpi_t_comm_metric_values();
#ifndef TAU_WINDOWS
const char TAUDECL *TauEnv_get_mpi_t_comm_metric_values();
#endif
int TAUDECL TauEnv_get_set_node();
const char* TAUDECL TauEnv_get_cupti_api();
const char* TAUDECL TauEnv_get_cuda_device_name();
Expand Down
6 changes: 5 additions & 1 deletion src/Profile/TauBfdUnimplemented.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include <Profile/TauBfd.h>

#include <stdio.h>
#ifndef TAU_WINDOWS
#include <dirent.h>
#else
#include <io.h>
#endif
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
Expand Down Expand Up @@ -152,7 +156,7 @@ char * Tau_demangle_name(const char * name) {
#else
char * Tau_demangle_name(const char * name) {
TAU_VERBOSE("Warning: No demangling support provided...\n");
dem_name = strdup(name);
char * dem_name = strdup(name);
return dem_name;
}
#endif // #if defined(__GNUC__)
7 changes: 7 additions & 0 deletions src/Profile/TauEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ using namespace std;
//#include <pwd.h>
#endif /* TAU_BGP */

#ifdef TAU_WINDOWS
/* We are on Windows which doesn't have strtok_s */
# define strtok_r strtok_s
#define TAU_LIB_DIR "tau2/win32/lib"
#endif


#define MAX_LN_LEN 2048

/* We should throttle if number n > a && percall < b .a and b are given below */
Expand Down
2 changes: 2 additions & 0 deletions src/Profile/TauInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,12 @@ int Tau_profile_exit_scorep()
}

/* disable this stupid thing */
#ifndef TAU_WINDOWS
extern "C" int __attribute__((weak)) PetscPopSignalHandler(void) {
return 0;
}
typedef int(*PetscPopSignalHandler_p)(void);
#endif

//////////////////////////////////////////////////////////////////////
// Initialize signal handling routines
Expand Down
2 changes: 2 additions & 0 deletions src/Profile/TauIoWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <utility>
#include <sstream>
#include <string>
#ifndef TAU_WINDOWS
#include <sys/time.h>
#endif


using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion src/Profile/TauMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ return 1; // SUCCESS
//////////////////////////////////////////////////////////////////////
extern "C" void Tau_track_mem_event_always(const char * name, const char * prefix, size_t size) {
const size_t event_len = strlen(name) + strlen(prefix) + 2;
#ifdef TAU_NEC_SX
#if defined TAU_NEC_SX || defined TAU_WINDOWS
char event_name[16384];
#else
char event_name[event_len];
Expand Down
1 change: 1 addition & 0 deletions src/Profile/TauMmapMemMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ void Tau_MemMgr_free(int tid, void *addr, size_t size)
#else /* TAU_WINDOWS */
#include <stdlib.h>
extern "C" bool Tau_MemMgr_initIfNecessary(void) {
return true;
}
extern "C" void Tau_MemMgr_finalizeIfNecessary(void) {
}
Expand Down
6 changes: 3 additions & 3 deletions src/Profile/TauUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <set>
#include <sstream>

#ifdef TAU_USE_STDCXX11
#if defined TAU_USE_STDCXX11 || defined TAU_WINDOWS
#include <thread>
#include <regex>
#else
Expand Down Expand Up @@ -818,7 +818,7 @@ extern "C" void Tau_util_plugin_register_callbacks(Tau_plugin_callbacks * cb, un
#endif /* TAU_OMPT */
}

#ifndef TAU_USE_STDCXX11
#if not defined TAU_USE_STDCXX11 || not defined TAU_WINDOWS
/* C version of regex_match in case compiler doesn't support C++11 featues */
/* Credit for logic: Laurence Gonsalves on stackoverflow.com */
extern "C" int Tau_C_regex_match(const char * input, const char * rege)
Expand Down Expand Up @@ -852,7 +852,7 @@ extern "C" const char* Tau_check_for_matching_regex(const char * input)
{

TauInternalFunctionGuard protects_this_function;
#ifdef TAU_USE_STDCXX11
#if defined TAU_USE_STDCXX11 || defined TAU_WINDOWS
for(std::list< std::string >::iterator it = regex_list.begin(); it != regex_list.end(); it++) {
if(regex_match(input, std::regex(*it))) {
return (*it).c_str();
Expand Down

0 comments on commit a57aa96

Please sign in to comment.