From c8a823a4cd59f43a454411f6d3b949603a4d5ac4 Mon Sep 17 00:00:00 2001 From: J Date: Fri, 17 Aug 2018 15:57:03 -0700 Subject: fixes and switch to using PYTORCH_BIN --- Makefile | 29 ++--------------------------- libcuda/cuda_runtime_api.cc | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index f1ae7e9..2d0466e 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,8 @@ LIBS = cuda-sim gpgpu-sim_uarch $(INTERSIM) gpgpusimlib TARGETS = ifeq ($(shell uname),Linux) TARGETS += $(SIM_LIB_DIR)/libcudart.so - TARGETS += $(SIM_LIB_DIR)/libcuda.so else # MAC TARGETS += $(SIM_LIB_DIR)/libcudart.dylib - TARGETS += $(SIM_LIB_DIR)/libcuda.dylib endif ifeq ($(NVOPENCL_LIBDIR),) @@ -166,30 +164,7 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib if [ ! -f $(SIM_LIB_DIR)/libcudart.so.9.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.9.0; fi if [ ! -f $(SIM_LIB_DIR)/libcudart.so.9.1 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.9.1; fi -$(SIM_LIB_DIR)/libcuda.so: makedirs $(LIBS) cudalib - g++ -shared -Wl,-soname,libcuda_$(GPGPUSIM_BUILD).so -Wl,--version-script=linux-so-version.txt\ - $(SIM_OBJ_FILES_DIR)/libcuda/*.o \ - $(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \ - $(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \ - $(SIM_OBJ_FILES_DIR)/gpgpu-sim/*.o \ - $(SIM_OBJ_FILES_DIR)/$(INTERSIM)/*.o \ - $(SIM_OBJ_FILES_DIR)/*.o -lm -lz -lGL -pthread \ - $(MCPAT) \ - -o $(SIM_LIB_DIR)/libcuda.so - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.1 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.1; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.2 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.2; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.3 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.3; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.4 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.4; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.5.0 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.5.0; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.5.5 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.5.5; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.6.0 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.6.0; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.6.5 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.6.5; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.7.5 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.7.5; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.8.0 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.8.0; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.9.0 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.9.0; fi - if [ ! -f $(SIM_LIB_DIR)/libcuda.so.9.1 ]; then ln -s libcuda.so $(SIM_LIB_DIR)/libcuda.so.9.1; fi - -$(SIM_LIB_DIR)/libcuda.dylib: makedirs $(LIBS) cudalib +$(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\ $(SIM_OBJ_FILES_DIR)/libcuda/*.o \ $(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \ @@ -198,7 +173,7 @@ $(SIM_LIB_DIR)/libcuda.dylib: makedirs $(LIBS) cudalib $(SIM_OBJ_FILES_DIR)/$(INTERSIM)/*.o \ $(SIM_OBJ_FILES_DIR)/*.o -lm -lz -pthread \ $(MCPAT) \ - -o $(SIM_LIB_DIR)/libcuda.dylib + -o $(SIM_LIB_DIR)/libcudart.dylib $(SIM_LIB_DIR)/libOpenCL.so: makedirs $(LIBS) opencllib g++ -shared -Wl,-soname,libOpenCL_$(GPGPUSIM_BUILD).so \ diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index b43a9ef..1c80941 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -780,7 +780,16 @@ __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol(void *dst, const char *symbo return g_last_cudaError = cudaSuccess; } +__host__ cudaError_t CUDARTAPI cudaMemGetInfo (size_t *free, size_t *total){ + if(g_debug_execution >= 3){ + announce_call(__my_func__); + } + //placeholder; should interact with cudaMalloc and cudaFree? + *free = 10000000000; + *total = 10000000000; + return g_last_cudaError = cudaSuccess; +} /******************************************************************************* * * @@ -1893,7 +1902,7 @@ char* get_app_binary_name(std::string abs_path){ void extract_ptx_files_using_cuobjdump(){ extern bool g_cdp_enabled; char command[1000]; - char *pytorch_path = getenv("PYTORCH_PATH"); + char *pytorch_bin = getenv("PYTORCH_BIN"); std::string app_binary = get_app_binary(); @@ -1902,8 +1911,8 @@ void extract_ptx_files_using_cuobjdump(){ int fd2=mkstemp(ptx_list_file_name); close(fd2); - if (pytorch_path!=NULL && strlen(pytorch_path)!=0){ - app_binary = std::string(std::string(pytorch_path) + "/vectorAdd"); + if (pytorch_bin!=NULL && strlen(pytorch_bin)!=0){ + app_binary = std::string(pytorch_bin); } //only want file names @@ -1934,6 +1943,7 @@ void extract_ptx_files_using_cuobjdump(){ if(!no_of_ptx){ printf("WARNING: Number of ptx in the executable file are 0. One of the reasons might be\n"); printf("\t1. CDP is enabled\n"); + printf("\t2. When using PyTorch, PYTORCH_BIN is not set correctly\n"); } std::ifstream infile(ptx_list_file_name); -- cgit v1.3