summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/Makefile4
-rw-r--r--src/cuda-sim/memory.h21
-rw-r--r--src/cuda-sim/ptx-stats.cc15
3 files changed, 13 insertions, 27 deletions
diff --git a/src/cuda-sim/Makefile b/src/cuda-sim/Makefile
index a2e8da3..3062d99 100644
--- a/src/cuda-sim/Makefile
+++ b/src/cuda-sim/Makefile
@@ -38,8 +38,7 @@ ifeq ($(INTEL),1)
CC = icc
endif
-CC_VERSION := $(shell gcc --version | perl -ne '/gcc\s+\(.*\)\s+([0-9.]+)/ and print $$1;')
-GNUC_CPP0X := $(shell gcc --version | perl -ne 'if (/gcc\s+\(.*\)\s+([0-9.]+)/){ if($$1 >= 4.3) {$$n=1} else {$$n=0;} } END { print $$n; }')
+include ../../version_detection.mk
OPT := -O3 -g3 -Wall -Wno-unused-function -Wno-sign-compare
ifeq ($(DEBUG),1)
@@ -61,7 +60,6 @@ OUTPUT_DIR=../../$(SIM_OBJ_FILES_DIR)/cuda-sim
OBJS := $(OUTPUT_DIR)/ptx_parser.o $(OUTPUT_DIR)/ptx_loader.o $(OUTPUT_DIR)/cuda_device_printf.o $(OUTPUT_DIR)/instructions.o $(OUTPUT_DIR)/cuda-sim.o $(OUTPUT_DIR)/ptx_ir.o $(OUTPUT_DIR)/ptx_sim.o $(OUTPUT_DIR)/memory.o $(OUTPUT_DIR)/ptx-stats.o $(OUTPUT_DIR)/decuda_pred_table/decuda_pred_table.o $(OUTPUT_DIR)/ptx.tab.o $(OUTPUT_DIR)/lex.ptx_.o $(OUTPUT_DIR)/ptxinfo.tab.o $(OUTPUT_DIR)/lex.ptxinfo_.o
-CUDART_VERSION:=$(shell $(CUDA_INSTALL_PATH)/bin/nvcc --version | awk '/release/ {print $$5;}' | sed 's/,//' | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($$1), 10*$$2);}')
OPT += -DCUDART_VERSION=$(CUDART_VERSION)
diff --git a/src/cuda-sim/memory.h b/src/cuda-sim/memory.h
index 5ebc0ad..f785b8b 100644
--- a/src/cuda-sim/memory.h
+++ b/src/cuda-sim/memory.h
@@ -30,23 +30,12 @@
#include "../abstract_hardware_model.h"
-#ifdef __GNUC__
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
- #include <unordered_map>
- #define mem_map std::unordered_map
- #define MEM_MAP_RESIZE(hash_size) m_data.rehash(hash_size)
-#else
- #include <ext/hash_map>
- namespace std {
- using namespace __gnu_cxx;
- }
- #define mem_map std::hash_map
- #define MEM_MAP_RESIZE(hash_size) m_data.resize(hash_size)
-#endif
-#else
- #include <map>
- #define mem_map std::map
+#include "../tr1_hash_map.h"
+#define mem_map tr1_hash_map
+#if tr1_hash_map_ismap == 1
#define MEM_MAP_RESIZE(hash_size)
+#else
+ #define MEM_MAP_RESIZE(hash_size) (m_data.rehash(hash_size))
#endif
#include <assert.h>
diff --git a/src/cuda-sim/ptx-stats.cc b/src/cuda-sim/ptx-stats.cc
index 3578be9..0a9f08d 100644
--- a/src/cuda-sim/ptx-stats.cc
+++ b/src/cuda-sim/ptx-stats.cc
@@ -80,14 +80,6 @@ public:
unsigned line;
};
-struct hash_ptx_file_line
-{
- std::size_t operator()(const ptx_file_line & pfline) const {
- std::hash<unsigned> hash_line;
- return hash_line(pfline.line);
- }
-};
-
// holds all statistics collected for a singe PTX source line
class ptx_file_line_stats
{
@@ -113,6 +105,13 @@ public:
#if (tr1_hash_map_ismap == 1)
typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats> ptx_file_line_stats_map_t;
#else
+struct hash_ptx_file_line
+{
+ std::size_t operator()(const ptx_file_line & pfline) const {
+ std::hash<unsigned> hash_line;
+ return hash_line(pfline.line);
+ }
+};
typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats, hash_ptx_file_line> ptx_file_line_stats_map_t;
#endif