summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongdong Li <[email protected]>2013-07-21 20:05:44 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:58 -0700
commitb5e2e7003f5d628d1c9baef08e6f6ae8b43e2ee5 (patch)
tree74d6cfa616bacc9e98a15f2e239aa6daa052f4ba
parent7415251d79cc19e209e79c8786b3361707a4675d (diff)
Review 69001:
More support for setup environment 1. More general solution to get CC_VERSION, work for Linux(OpenSUSE, Ubuntu, Debian) and OSX 2. Add zsh support, change == to = to make it compatible with bash, zsh and sh 3. Fix a bug in Makefile [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16640]
-rw-r--r--Makefile2
-rw-r--r--setup_environment12
-rw-r--r--version_detection.mk2
3 files changed, 8 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 9bf8f83..b6e3e2e 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ endif
BUILD_ROOT?=$(shell pwd)
export TRACE?=1
-NVCC_PATH=$(shellwhich nvcc)
+NVCC_PATH=$(shell which nvcc)
ifneq ($(shell which nvcc), "")
ifeq ($(DEBUG), 1)
export SIM_LIB_DIR=lib/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug
diff --git a/setup_environment b/setup_environment
index e538463..4d9472d 100644
--- a/setup_environment
+++ b/setup_environment
@@ -1,6 +1,6 @@
# see README before running this
-ps -p $$ | awk '/bash/ || / sh/ {exit 1;}' && echo "ERROR ** source setup_environment must be run in a bash or sh shell; see README" && exit
+ps -p $$ | awk '/bash/ || / sh/ || /zsh/ {exit 1;}' && echo "ERROR ** source setup_environment must be run in a bash, zsh or sh shell; see README" && exit
export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=
export GPGPUSIM_ROOT="$( cd "$( dirname "$BASH_SOURCE" )" && pwd )"
@@ -39,7 +39,7 @@ if [ $? = 1 ]; then
return;
fi
-CC_VERSION=`gcc --version | head -1 | sed -re "s/gcc\s+\(.*\)\s+([0-9.]+).*/\1/"`
+CC_VERSION=`gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($i,/[0-9]\.[0-9]\.[0-9]/)) {print $i}}}'`
CUDA_VERSION_STRING=`$CUDA_INSTALL_PATH/bin/nvcc --version | awk '/release/ {print $5;}' | sed 's/,//'`;
CUDA_VERSION_NUMBER=`echo $CUDA_VERSION_STRING | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($1), 10*$2);}'`
@@ -48,7 +48,7 @@ if [ $CUDA_VERSION_NUMBER -gt 4020 -o $CUDA_VERSION_NUMBER -lt 2030 ]; then
return;
fi
-if [ $# == '1' ] ;
+if [ $# = '1' ] ;
then
export GPGPUSIM_CONFIG=gcc-$CC_VERSION/cuda-$CUDA_VERSION_NUMBER/$1
else
@@ -88,17 +88,17 @@ fi
# SSH to remote node to generate PTX for OpenCL kernels when running on
# a node that does not have an NVIDIA driver installed.
# The remote node should have GPGPU-Sim installed at the same path
-if [ `uname` == "Darwin" ]; then
+if [ `uname` = "Darwin" ]; then
HOSTNAME_PREFIX=`hostname -s`;
export HOSTNAME_DOMAIN=`hostname | sed s/$HOSTNAME_PREFIX\.//`;
else
HOSTNAME_DOMAIN=`hostname -d`
fi
-if [ "x$HOSTNAME_DOMAIN" == "xece.ubc.ca" -a "$OPENCL_REMOTE_GPU_HOST" == "" ]; then
+if [ "x$HOSTNAME_DOMAIN" = "xece.ubc.ca" -a "$OPENCL_REMOTE_GPU_HOST" = "" ]; then
export OPENCL_REMOTE_GPU_HOST=aamodt-pc05.ece.ubc.ca
fi
HOSTNAME_F=`hostname -f`
-if [ "x$HOSTNAME_F" == "x$OPENCL_REMOTE_GPU_HOST" ]; then
+if [ "x$HOSTNAME_F" = "x$OPENCL_REMOTE_GPU_HOST" ]; then
unset OPENCL_REMOTE_GPU_HOST
fi
diff --git a/version_detection.mk b/version_detection.mk
index 245f46f..7f7925c 100644
--- a/version_detection.mk
+++ b/version_detection.mk
@@ -38,7 +38,7 @@ CUDA_VERSION_STRING:=$(shell $(CUDA_INSTALL_PATH)/bin/nvcc --version | awk '/rel
CUDART_VERSION:=$(shell echo $(CUDA_VERSION_STRING) | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($$1), 10*$$2);}')
# Detect GCC Version
-CC_VERSION := $(shell gcc --version | perl -ne '/gcc\s+\(.*\)\s+([0-9.]+)/ and print $$1;')
+CC_VERSION := $(shell gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($$i,/[0-9]\.[0-9]\.[0-9]/)) {print $$i}}}')
# Detect Support for C++11 (C++0x) from GCC Version
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; }')