summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--setup_environment20
2 files changed, 27 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 09e8c34..c3439fb 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,11 @@
# comment out next line to disable OpenGL support
# export OPENGL_SUPPORT=1
-export SNOW?=
+
+# for MacOS X
+ifeq ($(shell uname), Darwin)
+ export MACOSX_BUILD_FLAGS=-m32
+endif
ifeq ($(GPGPUSIM_CONFIG), debug)
export DEBUG=1
@@ -67,7 +71,7 @@ gpgpusim: check_setup_environment makedirs $(TARGETS)
check_setup_environment:
- @if [ ! -n "$(GPGPUSIM_ROOT)" ]; then \
+ @if [ ! -n "$(GPGPUSIM_ROOT)" -o ! -n "$(CUDA_INSTALL_PATH)" -o ! -n "$(GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN)" ]; then \
echo "ERROR *** run 'source setup_environment' before 'make'; please see README."; \
exit 101; \
else \
@@ -87,7 +91,7 @@ no_opencl_support:
@echo "Warning: gpgpu-sim is building without opencl support. Make sure NVOPENCL_LIBDIR and NVOPENCL_INCDIR are set"
$(SIM_LIB_DIR)/libcudart.so: $(LIBS) cudalib
- g++ $(SNOW) -shared -Wl,-soname,libcudart.so \
+ g++ $(MACOSX_BUILD_FLAGS) -shared -Wl,-soname,libcudart.so \
$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
@@ -100,7 +104,7 @@ $(SIM_LIB_DIR)/libcudart.so: $(LIBS) cudalib
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.4 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.4; fi
$(SIM_LIB_DIR)/libcudart.dylib: $(LIBS) cudalib
- g++ $(SNOW) -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\
+ g++ $(MACOSX_BUILD_FLAGS) -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 \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
@@ -110,7 +114,7 @@ $(SIM_LIB_DIR)/libcudart.dylib: $(LIBS) cudalib
-o $(SIM_LIB_DIR)/libcudart.dylib
$(SIM_LIB_DIR)/libOpenCL.so: $(LIBS) opencllib
- g++ $(SNOW) -shared -Wl,-soname,libOpenCL.so \
+ g++ $(MACOSX_BUILD_FLAGS) -shared -Wl,-soname,libOpenCL.so \
$(SIM_OBJ_FILES_DIR)/libopencl/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
diff --git a/setup_environment b/setup_environment
index ff089dc..0e2fe1c 100644
--- a/setup_environment
+++ b/setup_environment
@@ -9,6 +9,11 @@ if [ ! -d "$CUDA_INSTALL_PATH" ]; then
return;
fi
+# for MacOS X
+if [ `uname` = "Darwin" ]; then
+ echo "Detected MacOS X platform..."
+fi
+
# to run the debug build of GPGPU-Sim run:
# source setup_environment debug
if [ $# == '1' ] ;
@@ -40,7 +45,11 @@ fi
# native CUDA and OpenCL applications. GPGPU-Sim is dynamically linked
# against instead of the CUDA toolkit. This replaces this cumbersome
# static link setup in prior GPGPU-Sim releases.
-export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -re 's/.*gpgpu_sim.*(release|debug)://'`
+if [ `uname` = "Darwin" ]; then
+ export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -Ee 's/.*gpgpu_sim.*(release|debug)://'`
+else
+ export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -re 's/.*gpgpu_sim.*(release|debug)://'`
+fi
export LD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$LD_LIBRARY_PATH
export PATH=`echo $PATH | sed "s#$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:##"`
export PATH=$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:$PATH
@@ -59,7 +68,12 @@ 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
-HOSTNAME_DOMAIN=`hostname -d`
+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
export OPENCL_REMOTE_GPU_HOST=aamodt-pc05.ece.ubc.ca
fi
@@ -67,3 +81,5 @@ HOSTNAME_F=`hostname -f`
if [ "x$HOSTNAME_F" == "x$OPENCL_REMOTE_GPU_HOST" ]; then
unset OPENCL_REMOTE_GPU_HOST
fi
+
+export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=1