summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rw-r--r--cuobjdump_to_ptxplus/Makefile46
-rw-r--r--setup_environment5
-rw-r--r--src/cuda-sim/ptx_loader.cc2
4 files changed, 37 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 33534ce..5847bea 100644
--- a/Makefile
+++ b/Makefile
@@ -37,12 +37,16 @@ else
export DEBUG=0
endif
-ifeq ($(DEBUG), 1)
- export SIM_LIB_DIR=lib/debug
- export SIM_OBJ_FILES_DIR=build/debug
-else
- export SIM_LIB_DIR=lib/release
- export SIM_OBJ_FILES_DIR=build/release
+NVCC_PATH=$(shellwhich nvcc)
+ifneq ($(shell which nvcc), "")
+ CUDA_VERSION=$(shell nvcc --version | grep release | sed -re 's/.*release ([0-9]+\.[0-9]+).*/\1/')
+ ifeq ($(DEBUG), 1)
+ export SIM_LIB_DIR=lib/$(CUDA_VERSION)/debug
+ export SIM_OBJ_FILES_DIR=build/$(CUDA_VERSION)/debug
+ else
+ export SIM_LIB_DIR=lib/$(CUDA_VERSION)/release
+ export SIM_OBJ_FILES_DIR=build/$(CUDA_VERSION)/release
+ endif
endif
LIBS = cuda-sim gpgpu-sim_uarch intersim gpgpusimlib
@@ -160,6 +164,7 @@ makedirs:
if [ ! -d $(SIM_OBJ_FILES_DIR)/gpgpu-sim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpgpu-sim; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/libopencl ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libopencl; fi;
if [ ! -d $(SIM_OBJ_FILES_DIR)/intersim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/intersim; fi;
+ if [ ! -d $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus; fi;
all:
$(MAKE) gpgpusim
diff --git a/cuobjdump_to_ptxplus/Makefile b/cuobjdump_to_ptxplus/Makefile
index 64f028d..62ef492 100644
--- a/cuobjdump_to_ptxplus/Makefile
+++ b/cuobjdump_to_ptxplus/Makefile
@@ -3,44 +3,44 @@ LEXFLAGS = -B
YACC = bison
YFLAGS = -t -d --report=all --verbose
CC = gcc
-CCFLAGS = -ggdb -fPIC -Wall -Wno-unused-function -Wno-sign-compare
+CCFLAGS = -ggdb -fPIC -Wall -Wno-unused-function -Wno-sign-compare
CXX = g++
CXXFLAGS = ${CCFLAGS}
LD = g++
LDFLAGS = ${CCFLAGS}
+OUTPUT_DIR=../$(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus
+CXXFLAGS += -I $(OUTPUT_DIR) -I . -I ../src/cuda-sim/
-SASS_PARSER_OBJECTS = sass_lexer.o sass_parser.o
-ELF_PARSER_OBJECTS = elf_lexer.o elf_parser.o
-HEADER_PARSER_OBJECTS = header_parser.o header_lexer.o
-PTX_PARSER_OBJECTS = ptx.tab.o lex.ptx_.o
+SASS_PARSER_OBJECTS = $(OUTPUT_DIR)/sass_lexer.o $(OUTPUT_DIR)/sass_parser.o
+ELF_PARSER_OBJECTS = $(OUTPUT_DIR)/elf_lexer.o $(OUTPUT_DIR)/elf_parser.o
+HEADER_PARSER_OBJECTS = $(OUTPUT_DIR)/header_parser.o $(OUTPUT_DIR)/header_lexer.o
+PTX_PARSER_OBJECTS = $(OUTPUT_DIR)/ptx.tab.o $(OUTPUT_DIR)/lex.ptx_.o
-all: cuobjdump_to_ptxplus
+all: $(OUTPUT_DIR)/cuobjdump_to_ptxplus
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
.SECONDARY:
-cuobjdump_to_ptxplus: cuobjdumpInst.o cuobjdumpInstList.o cuobjdump_to_ptxplus.o $(PTX_PARSER_OBJECTS) $(SASS_PARSER_OBJECTS) $(ELF_PARSER_OBJECTS) $(HEADER_PARSER_OBJECTS)
- ${LD} ${LDFLAGS} -o $@ cuobjdumpInst.o cuobjdumpInstList.o cuobjdump_to_ptxplus.o $(PTX_PARSER_OBJECTS) $(SASS_PARSER_OBJECTS) $(ELF_PARSER_OBJECTS) $(HEADER_PARSER_OBJECTS)
+$(OUTPUT_DIR)/cuobjdump_to_ptxplus: $(OUTPUT_DIR)/cuobjdumpInst.o $(OUTPUT_DIR)/cuobjdumpInstList.o $(OUTPUT_DIR)/cuobjdump_to_ptxplus.o $(PTX_PARSER_OBJECTS) $(SASS_PARSER_OBJECTS) $(ELF_PARSER_OBJECTS) $(HEADER_PARSER_OBJECTS)
+ ${LD} ${LDFLAGS} -o $@ $(OUTPUT_DIR)/cuobjdumpInst.o $(OUTPUT_DIR)/cuobjdumpInstList.o $(OUTPUT_DIR)/cuobjdump_to_ptxplus.o $(PTX_PARSER_OBJECTS) $(SASS_PARSER_OBJECTS) $(ELF_PARSER_OBJECTS) $(HEADER_PARSER_OBJECTS)
+
lex.ptx_.c : ../src/cuda-sim/ptx.l
- ${LEX} ${LEXFLAGS} ../src/cuda-sim/ptx.l
+ ${LEX} ${LEXFLAGS} ../src/cuda-sim/ptx.l
ptx.tab.c : ../src/cuda-sim/ptx.y
- ${YACC} ${YFLAGS} --name-prefix=ptx_ -v ../src/cuda-sim/ptx.y
+ ${YACC} ${YFLAGS} --name-prefix=ptx_ -v ../src/cuda-sim/ptx.y
ptx.tab.h : ptx.tab.c
-lex.ptx_.o : lex.ptx_.c ptx.tab.h
- rm -f opcodes.def opcodes.h
- ln -s ../src/cuda-sim/opcodes.def opcodes.def
- ln -s ../src/cuda-sim/opcodes.h opcodes.h
- ${CXX} ${CXXFLAGS} -c lex.ptx_.c
+$(OUTPUT_DIR)/lex.ptx_.o : lex.ptx_.c ptx.tab.h
+ ${CXX} ${CXXFLAGS} -c lex.ptx_.c -o $@
-ptx.tab.o : ptx.tab.c ptx_parser.h
- ${CXX} ${CXXFLAGS} -c ptx.tab.c
+$(OUTPUT_DIR)/ptx.tab.o : ptx.tab.c ptx_parser.h
+ ${CXX} ${CXXFLAGS} -c ptx.tab.c -o $@
%_lexer.cc: %.l %_parser.hh
@@ -54,13 +54,13 @@ ptx.tab.o : ptx.tab.c ptx_parser.h
%_parser.hh: %_parser.cc
:
-%.o: %.cc
+$(OUTPUT_DIR)/%.o: %.cc
$(CXX) ${CXXFLAGS} -c -o $@ $<
-%.o: %.cpp %.h
+$(OUTPUT_DIR)/%.o: %.cpp %.h
$(CXX) ${CXXFLAGS} -c -o $@ $<
-%.o: %.c %.h
+$(OUTPUT_DIR)/%.o: %.c %.h
${CC} ${CCFLAGS} -c -o $@ $<
SRCS = $(shell ls *.cc)
@@ -72,13 +72,11 @@ depend:
makedepend -fMakefile.makedepend $(SRCS) 2> /dev/null
clean:
- rm -f opcodes.def opcodes.h
- rm -f lex.ptx_.c ptx.tab.c ptx.tab.h lex.ptx_.o ptx.tab.o ptx.output
+ rm -f lex.ptx_.c ptx.tab.c ptx.tab.h ptx.output
rm -f elf_lexer.cc elf_parser.cc elf_parser.hh elf_parser.output
rm -f sass_lexer.cc sass_parser.cc sass_parser.hh sass_parser.output
rm -f header_lexer.cc header_parser.cc header_parser.hh header_parser.output
- rm -f *.o
- rm -f cuobjdump_to_ptxplus
+ rm -rf $(OUTPUT_DIR)
rm -f Makefile.makedepend Makefile.makedepend.bak
include Makefile.makedepend
diff --git a/setup_environment b/setup_environment
index 94f313f..b59a4c1 100644
--- a/setup_environment
+++ b/setup_environment
@@ -23,11 +23,12 @@ fi
# to run the debug build of GPGPU-Sim run:
# source setup_environment debug
+CUDA_VERSION=`nvcc --version | grep release | sed -re 's/.*release ([0-9]+\.[0-9]+).*/\1/'`
if [ $# == '1' ] ;
then
- export GPGPUSIM_CONFIG=$1
+ export GPGPUSIM_CONFIG=$CUDA_VERSION/$1
else
- export GPGPUSIM_CONFIG=release
+ export GPGPUSIM_CONFIG=$CUDA_VERSION/release
fi
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index 4119377..56b9449 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -110,7 +110,7 @@ char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptxfilenam
// Run cuobjdump_to_ptxplus
char commandline[1024];
int result;
- snprintf(commandline, 1024, "$GPGPUSIM_ROOT/cuobjdump_to_ptxplus/cuobjdump_to_ptxplus %s %s %s %s",
+ snprintf(commandline, 1024, "$GPGPUSIM_ROOT/build/$GPGPUSIM_CONFIG/cuobjdump_to_ptxplus/cuobjdump_to_ptxplus %s %s %s %s",
ptxfilename.c_str(),
sassfilename.c_str(),
elffilename.c_str(),