Skip to content

Commit

Permalink
add some environment checks
Browse files Browse the repository at this point in the history
  • Loading branch information
aamodt committed Jun 28, 2012
1 parent aa63b43 commit ffc6d5e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 22 deletions.
37 changes: 34 additions & 3 deletions benchmarks/Makefile.ispass-2009
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Please see README.ISPASS-2009 for instructions

BINDIR:=$(shell pwd)/../bin/
BINSUBDIR=release
Expand All @@ -10,7 +11,8 @@ SETENV=export BINDIR=$(BINDIR); \
export OPENMPI_BINDIR=/usr/lib64/mpi/gcc/openmpi/bin/;
noinline?=0

default: common
.PHONY: check_environment
default: check_environment common
$(SETENV) make noinline=$(noinline) -C CUDA/AES
$(SETENV) make noinline=$(noinline) -C CUDA/BFS
cd ./CUDA/CP/; export PARBOIL_ROOT=`pwd`; cd common/src; make; cd -; ./parboil compile cp cuda_short; cp benchmarks/cp/build/cuda_short/cp $(BINDIR)/$(BINSUBDIR)/CP
Expand All @@ -25,11 +27,40 @@ default: common
$(SETENV) make noinline=$(noinline) -C CUDA/STO
$(SETENV) make noinline=$(noinline) -C CUDA/WP

check_environment:
@if [ ! -n "$(CUDA_INSTALL_PATH)" ]; then \
echo "ERROR *** CUDA_INSTALL_PATH not set; please see README.ISPASS-2009"; \
exit 201; \
elif [ ! -d "$(CUDA_INSTALL_PATH)" ]; then \
echo "ERROR *** CUDA_INSTALL_PATH=$(CUDA_INSTALL_PATH) invalid (directory does not exist)."; \
exit 202; \
elif [ ! -n "$(NVIDIA_COMPUTE_SDK_LOCATION)" ]; then \
echo "ERROR *** NVIDIA_COMPUTE_SDK_LOCATION not set; please see README.ISPASS-2009"; \
exit 203; \
elif [ ! -d "$(NVIDIA_COMPUTE_SDK_LOCATION)" ]; then \
echo "ERROR *** NVIDIA_COMPUTE_SDK_LOCATION=$(NVIDIA_COMPUTE_SDK_LOCATION) invalid (directory does not exist)."; \
exit 204; \
elif [ ! -f "$(NVIDIA_COMPUTE_SDK_LOCATION)/C/lib/libcutil_x86_64.a" -a ! -f "$(NVIDIA_COMPUTE_SDK_LOCATION)/C/lib/libcutil.a" ]; then \
echo "ERROR *** could not find $(NVIDIA_COMPUTE_SDK_LOCATION)/C/lib/libcutil_x86_64.a (or libcutil.a)"; \
echo " Build the NVIDIA GPU Computing SDK; please see README.ISPASS-2009"; \
exit 205; \
else \
NVCC_PATH=`which nvcc`; \
if [ $$? = 1 ]; then \
echo ""; \
echo "ERROR ** nvcc (from CUDA Toolkit) was not found in PATH but required to build the ISPASS 2009 benchmarks."; \
echo " Try adding $(CUDA_INSTALL_PATH)/bin/ to your PATH environment variable."; \
echo " Please also be sure to read README.ISPASS-2009 if you have not done so."; \
echo ""; \
exit 206; \
else true; \
fi \
fi

common:
rm -f ../common; ln -s $(NVIDIA_COMPUTE_SDK_LOCATION)/C/common ../common;
@ if [ ! -e ../common/common.mk ]; then echo "NVIDIA_COMPUTE_SDK_LOCATION environment variable not set properly."; exit 1; fi

clean: common
clean: check_environment common
$(SETENV) make clean -C CUDA/AES
$(SETENV) make clean -C CUDA/BFS
cd ./CUDA/CP/; ./parboil clean cp cuda_short
Expand Down
44 changes: 27 additions & 17 deletions benchmarks/README.ISPASS-2009
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
The directories AES, BFS, CP, LPS, LIB, MUM, NN, NQU, RAY, STO, and WP (see the
CUDA directory) contain benchmarks used in the ISPASS 2009 paper on GPGPU-Sim.
Their original sources are listed below.
The directories AES, BFS, CP, LPS, LIB, MUM, NN, NQU, RAY, STO, and WP (see
the CUDA directory) contain benchmarks used in the ISPASS 2009 paper on
GPGPU-Sim. Their original sources are listed below.

The instructions below describe how to build and run the benchmarks assuming
you are using GPGPU-Sim v3.x. This series of instructions is essentially
the procedure we follow when using GPGPU-Sim v3.x in our research at UBC.
you are using GPGPU-Sim v3.x. This series of instructions is essentially the
procedure we follow when using GPGPU-Sim v3.x in our research at UBC.

Assuming all dependencies required by the benchmarks are satisifed, you can
build/run them by doing the following:

1. Install/build the NVIDIA CUDA SDK benchmarks (required since some of the
ISPASS 2009 benchmarks use a library you need to build in this step).

2. Open Makefile.ispass-2009 in your favorite text editor and set the variables
At the top of the file to suit your environment.
2. Open Makefile.ispass-2009 in your favorite text editor and set the
variables At the top of the file to suit your environment.

3. Define the following environment variables:

NVIDIA_COMPUTE_SDK_LOCATION
CUDA_INSTALL_PATH
NVIDIA_COMPUTE_SDK_LOCATION

The first, CUDA_INSTALL_PATH, should point to the directory you installed
the NVIDIA CUDA Toolkit (e.g., /usr/local/cuda).

4. run "make -f Makefile.ispass-2009" in this directory. You should NOT need to
copy or move any files for this to work.
The second, NVIDIA_COMPUTE_SDK_LOCATION, should point to the directory you
installed the NVIDIA GPU Computing SDK (e.g., ~/NVIDIA_GPU_Computing_SDK)

You must also ensure your PATH includes $CUDA_INSTALL_PATH/bin.

4. run "make -f Makefile.ispass-2009" in this directory. You should NOT need
to copy or move any files for this to work.

5. Verify binaries were generated for the benchmarks in ../bin/release/
(relative to the directory this file located in)
Expand All @@ -31,18 +39,20 @@ build/run them by doing the following:
not already done so, build GPGPU-Sim now.

7. Place a link to the configuration files (gpgpusim.config and the
interconnect configuration file) in the simulation run directory. You can do
this using the script "setup_config.sh" in this directory, which creates
symbolic links. For example:
interconnect configuration file) in the simulation run directory. You can
do this using the script "setup_config.sh" you will find in this directory,
which creates symbolic links. For example type:

./setup_config.sh Fermi

To change the configuration, you need to first run
Aside: If later you want to change the configuration, you need to first run

./setup_config.sh --cleanup

8. Run one of the applications by typing the command line in the README.GPGPU-Sim
in the benchmark directory. For example,
then run ./setup_config.sh again with the configuration you want.

8. Run one of the applications by typing the command line in the
README.GPGPU-Sim in the benchmark directory. For example,

cd CUDA/AES
sh README.GPGPU-Sim
Expand All @@ -57,7 +67,7 @@ build/run them by doing the following:
Example of running the simulator in gdb (starting from this directory):

cd CUDA/AES
gdb --args `cat README.GPGPU-Sim` # note: different steps required for WP
gdb --args `cat README.GPGPU-Sim` # different steps required for WP


###############################################################################
Expand Down
10 changes: 8 additions & 2 deletions benchmarks/setup_config.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
#!/bin/sh

if [ ! -n "$GPGPUSIM_ROOT" ]; then
echo "ERROR ** GPGPUSIM_ROOT not set. Run setup_environment first.\n";
fi

BENCHMARKS=`ls -1 CUDA | sed 's/\(.\)/\.\/CUDA\/\1/'`

GPGPUSIM_CONFIG=$1
if [ "x$GPGPUSIM_CONFIG" = "x" ]; then
echo "";
echo "Usage: $0 <GPGPU-Sim Config Name | --cleanup>"
echo "where <GPGPU-Sim Config Name> is one of:"
ls -1 $GPGPUSIM_ROOT/configs
echo "";
exit 0
fi

if [ "x$GPGPUSIM_ROOT" = "x" ]; then
GPGPUSIM_ROOT="$PWD/.."
fi

BENCHMARKS=`ls -1 CUDA | sed 's/\(.\)/\.\/CUDA\/\1/'`

if [ $1 = "--cleanup" ]; then
echo "Removing existing configs in the following directories:"
for BMK in $BENCHMARKS; do
Expand Down

0 comments on commit ffc6d5e

Please sign in to comment.