summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--libcuda/cuda_runtime_api.cc16
-rw-r--r--setup_environment5
3 files changed, 18 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 042330c..d7f103b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
LOG:
Version 3.1.2+edits (development branch) versus 3.1.2
- Added GPUWattch GPGPU power model based on McPAT 0.8beta.
+- Bug Fixes:
+ - fix CUBIN parsing on Mac OS X
Version 3.1.2 versus 3.1.1
- Added support for CUDA 4.1 and 4.2 (PTX 3.0).
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 4739f64..7535fa3 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -137,6 +137,10 @@
#include <pthread.h>
#include <semaphore.h>
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
+
extern void synchronize();
extern void exit_simulation();
@@ -1260,17 +1264,23 @@ extern "C" FILE *cuobjdump_in;
//! executable instead of the application binary.
//!
std::string get_app_binary(){
+ char self_exe_path[1025];
+#ifdef __APPLE__
+ uint32_t size = sizeof(self_exe_path);
+ if( _NSGetExecutablePath(self_exe_path,&size) != 0 ) {
+ printf("GPGPU-Sim ** ERROR: _NSGetExecutablePath input buffer too small\n");
+ exit(1);
+ }
+#else
std::stringstream exec_link;
- // exec_link << "/proc/" << getpid() << "/exe";
exec_link << "/proc/self/exe";
- char self_exe_path[1025];
ssize_t path_length = readlink(exec_link.str().c_str(), self_exe_path, 1024);
assert(path_length != -1);
self_exe_path[path_length] = '\0';
+#endif
printf("self exe links to: %s\n", self_exe_path);
-
return self_exe_path;
}
diff --git a/setup_environment b/setup_environment
index 8298965..99441e1 100644
--- a/setup_environment
+++ b/setup_environment
@@ -72,11 +72,12 @@ fi
# against instead of the CUDA toolkit. This replaces this cumbersome
# static link setup in prior GPGPU-Sim releases.
if [ `uname` = "Darwin" ]; then
- export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -Ee 's/.*gpgpu_sim.*(release|debug)://'`
+ export DYLD_LIBRARY_PATH=`echo $DYLD_LIBRARY_PATH | sed -Ee 's/.*gpgpu_sim.*(release|debug)://'`
+ export DYLD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$DYLD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -re 's/.*gpgpu_sim.*(release|debug)://'`
+ export LD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$LD_LIBRARY_PATH
fi
-export LD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$LD_LIBRARY_PATH
# The following sets OPENCL_REMOTE_GPU_HOST which is used by GPGPU-Sim to