summaryrefslogtreecommitdiff
path: root/gpgpusim_gen_setup_environment.cmake
diff options
context:
space:
mode:
authorWilliamMTK <[email protected]>2024-04-04 18:13:54 -0400
committerGitHub <[email protected]>2024-04-04 18:13:54 -0400
commitbc8061fd1e3c26be37e2cbb83ff9ca26e6f4dead (patch)
tree8ed2e1e3b37a6add49dc18f73ce7ea17ff46ab06 /gpgpusim_gen_setup_environment.cmake
parent63893019e953269d1b0fb38e1fa8754992dd8d80 (diff)
Migrate gpgpu-sim build system to cmake (#66)
* migrate_cmake: add package dependency checking * migrate_cmake: port setup_environment to CMake * migrate_cmake: break dependency checking and env export gen to different .cmake files * migrate_cmake: use CUDAToolkit_FOUND to test for CUDA compiler * migrate_cmake: use CUDAToolkit_FOUND to test for CUDA compiler * migrate_cmake: use CUDAToolkit_FOUND to test for CUDA compiler * migrate_cmake: properly parse for cuda version number * migrate_cmake: set highest CUDA supported to be 11.10.x * migrate_cmake: specify top level CMake file * migrate_cmake: add libcuda cmake file * migrate_cmake: use global compiler options and definitions * migrate_cmake: add cmake file to src * migrate_cmake: add cmake files for cuda-sim folder * migrate_cmake: add cmake files to gpgpu-sim folder * migrate_cmake: add cmake files for intersim * migrate_cmake: add short test using cmake * migrate_cmake: bump CXX standard requirement to 17 * Add cmake files for accelwattch * migrate_cmake: remove use of GLOB to grab source files * migrate_cmake: comment out the write protection on generated instructions.h * migrate_cmake: create sym folder and add newline to generated setup file * migrate_cmake: fix some path issues * migrate_cmake: let cmake thinks flex and bison generate CXX files * migrate_cmake: fix not linking pthread properly * migrate_cmake: remove debug message * migrate_cmake: add empty libopencl cmake file * migrate_cmake: install phase and runtime version detect * Added install phase to install the shared object and add symlinks * Changes with CUDA toolkit will be detected and triggered a rebuild * GPGPU-Sim detailed version string will be updated on each build * Typo fix and fix correct bin dir * Replace gcc -> g++ in intersim * ignore setup * check CMAKE_BUILD_TYPE * set DCMAKE_BUILD_TYPE --------- Co-authored-by: JRPAN <[email protected]>
Diffstat (limited to 'gpgpusim_gen_setup_environment.cmake')
-rw-r--r--gpgpusim_gen_setup_environment.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/gpgpusim_gen_setup_environment.cmake b/gpgpusim_gen_setup_environment.cmake
new file mode 100644
index 0000000..e74a7f5
--- /dev/null
+++ b/gpgpusim_gen_setup_environment.cmake
@@ -0,0 +1,31 @@
+# Need to create a setup script to set some variables for others to interact with
+set(SETUP_SCRIPT_FILENAME "setup")
+message(STATUS "Writing setup commands to '${SETUP_SCRIPT_FILENAME}'")
+file(WRITE ${SETUP_SCRIPT_FILENAME} "export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=1\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export GPGPUSIM_ROOT=${PROJECT_SOURCE_DIR}\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export GPGPUSIM_CONFIG=${GPGPUSIM_CONFIG}\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export CUDA_INSTALL_PATH=${CUDAToolkit_TARGET_DIR}\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export PATH=`echo $PATH | sed 's#$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:##'`\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export PATH=$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:$PATH\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export CUDA_VERSION_NUMBER=${CUDA_VERSION_NUMBER}\n")
+if(CUDA_VERSION_NUMBER GREATER_EQUAL 6000)
+ file(APPEND ${SETUP_SCRIPT_FILENAME} "export PTX_SIM_USE_PTX_FILE=1.ptx\n")
+ file(APPEND ${SETUP_SCRIPT_FILENAME} "export PTX_SIM_KERNELFILE=_1.ptx\n")
+ file(APPEND ${SETUP_SCRIPT_FILENAME} "export CUOBJDUMP_SIM_FILE=jj\n")
+endif()
+# TODO What about OpenCL support?
+
+# setting LD_LIBRARY_PATH as follows enables GPGPU-Sim to be invoked by
+# 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.
+# Create a softlink for backward support
+if(APPLE)
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export DYLD_LIBRARY_PATH=`echo $DYLD_LIBRARY_PATH | sed -Ee 's#'$GPGPUSIM_ROOT'\/lib\/[0-9]+\/(debug|release):##'`\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export DYLD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$DYLD_LIBRARY_PATH\n")
+else()
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -re 's#'$GPGPUSIM_ROOT'\/lib\/[0-9]+\/(debug|release):##'`\n")
+file(APPEND ${SETUP_SCRIPT_FILENAME} "export LD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$LD_LIBRARY_PATH\n")
+endif()
+
+# TODO ignore the OPENCL_REMOTE_GPU_HOST part? \ No newline at end of file