Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate gpgpu-sim build system to cmake #66

Merged
merged 35 commits into from
Apr 4, 2024

Conversation

William-An
Copy link

@William-An William-An commented Feb 9, 2024

accel-sim#279
Currently most of gpgpu-sim components can be built with CMake, except for:

  • OpenCL support
  • cuobjdump_to_ptxplus

Also, some small modifications need to be made, like:

  • Adding install phase to install the shared object and create symlink
  • Detect CUDA compiler at build phase instead of config time

Couple of things need to be taken care of:

  • When building instruction.h in cuda-sim, need to use chmod a-w due to potential umask setting
  • GCC and CUDA version compatibility check (i.e. GCC 11 is not supported for < CUDA 11.4, need to take care of this)

The build is tested with rodinia-2.0 and RTX2060 config. I have also prepared the GitHub action script (cmake.yml) to run the CI test but it will fail since cmake is missing in the docker image.

What it will look like right now:

# Config
➜ cmake -B build                                     
-- The CXX compiler identification is GNU 7.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found BISON: /usr/bin/bison (found version "3.0.4") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found CUDAToolkit: /home/tgrogers-raid/a/common/cuda-11.0/include (found version "11.0.167") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Found Python3: /home/tgrogers-raid/a/an107/miniconda3/bin/python3.10 (found version "3.10.8") found components: Interpreter 
-- Additional settings for GPGPU-Sim
--   Checking for OS
--   Checking for OS - Linux
--   Checking GPGPU-Sim version
--   Checking GPGPU-Sim version - 4.2.0
--   Checking git commit hash
--   Checking git commit hash - 1c721b41446ca253dc2af3bd1a3b664e5e11de93
--   Checking CXX compiler
--   Checking CXX compiler - /usr/bin/g++
--   Checking CXX compiler version
--   Checking CXX compiler version - 7.5.0
--   Checking CUDA compiler
--   Checking CUDA compiler - /home/tgrogers-raid/a/common/cuda-11.0/bin/nvcc
--   Checking CUDA compiler version
--   Checking CUDA compiler version - 11.0.167
--   Checking for GPGPU-Sim power model
--   Checking for GPGPU-Sim power model - /home/tgrogers-raid/a/an107/gpgpu-sim_distribution/src/accelwattch/
--   Checking for CMAKE_BUILD_TYPE
--   Checking for CMAKE_BUILD_TYPE - not set
--   Setting binary directory to /home/tgrogers-raid/a/an107/gpgpu-sim_distribution/build
-- Additional settings for GPGPU-Sim - done
-- Be sure to run 'source setup_environment' before you run CUDA program with GPGPU-Sim or building with externalsimulator like SST
-- Writing setup commands to 'setup'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tgrogers-raid/a/an107/gpgpu-sim_distribution/build

# Build
➜ cmake --build build -j
[  1%] [BISON][cuobjdump_parser] Building parser with bison 3.0.4
[  1%] [FLEX][cuobjdump_lexer] Building scanner with flex 2.6.4
[  2%] [FLEX][intersim_config_lexer] Building scanner with flex 2.6.4
[  2%] [BISON][intersim_config_parser] Building parser with bison 3.0.4
[  3%] Building CXX object src/CMakeFiles/gpgpusim_entrypoint.dir/gpgpusim_entrypoint.cc.o
[  3%] Building CXX object src/CMakeFiles/gpgpusim_entrypoint.dir/abstract_hardware_model.cc.o
[  4%] Generating instructions.h
[ 16%] Building CXX object src/CMakeFiles/gpgpusim_entrypoint.dir/debug.cc.o
[ 44%] Building CXX object src/accelwattch/CMakeFiles/accelwattch.dir/cacti/parameter.cc.o
...
[ 96%] Built target gpgpusim_entrypoint
[ 96%] Linking CXX static library ../gcc-7.5.0/cuda-11000/release/libcuda.a
[ 96%] Built target cuda
[ 97%] Linking CXX static library ../../gcc-7.5.0/cuda-11000/release/libptxsim.a
[ 98%] Linking CXX static library ../../gcc-7.5.0/cuda-11000/release/libintersim.a
[ 98%] Built target ptxsim
[ 98%] Built target intersim
[ 98%] Linking CXX static library ../../gcc-7.5.0/cuda-11000/release/libgpgpusim.a
[ 98%] Built target gpgpusim
/home/tgrogers-raid/a/an107/gpgpu-sim_distribution/src/accelwattch/logic.cc: In member function ‘void FunctionalUnit::computeEnergy(bool)’:
/home/tgrogers-raid/a/an107/gpgpu-sim_distribution/src/accelwattch/logic.cc:858:39: warning: ‘FU_duty_cycle’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     power.readOp.dynamic *= sckRation * FU_duty_cycle;
                             ~~~~~~~~~~^~~~~~~~~~~~~~~
[ 99%] Linking CXX static library ../../gcc-7.5.0/cuda-11000/release/libaccelwattch.a
[ 99%] Built target accelwattch
[100%] Linking CXX shared library gcc-7.5.0/cuda-11000/release/libcudart.so
[100%] Built target cudart

William-An and others added 27 commits February 6, 2024 12:27
@JRPan
Copy link

JRPan commented Feb 9, 2024

I can update the docker image.
Or you can just pull the repo and add cmake to dockerfile and push. It will automatically build and update the docker hub image.

@JRPan
Copy link

JRPan commented Feb 9, 2024

I can update the docker image. Or you can just pull the repo and add cmake to dockerfile and push. It will automatically build and update the docker hub image.

Actually just updated it lol. It's building now.
accel-sim/Dockerfile@2dc3a3d

But why not adding this to the front end (Accel-Sim) directly? I would assume we probably would still keep the make and most of us would probably use Accel-Sim.

@William-An
Copy link
Author

Yeah, I am planning to add cmake support for accel-sim as well. The problem with just adding cmake to accel-sim is that generally it is not a good practice to mix up make and cmake, so I figured port the underlying gpgpu-sim first and link it with accel-sim.

@William-An
Copy link
Author

Okay the build is good but I did not create enough symlinks for the different so versions. Will fix this by adding an install target.

@JRPan
Copy link

JRPan commented Feb 9, 2024

btw did you ask Tim? I wonder if he supports this.

	* 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
@William-An William-An marked this pull request as ready for review February 10, 2024 01:20
@William-An William-An requested review from a team and cesar-avalos3 and removed request for a team February 10, 2024 01:21
@William-An
Copy link
Author

Not sure if we will still keep the OpenCL and ptxplus parts, but it will be trivial to add build files to those.

@JRPan JRPan self-requested a review April 3, 2024 17:53
@JRPan
Copy link

JRPan commented Apr 4, 2024

In the Cmake the parser is being built with C++ I think. So the "extern" keywords need to be removed otherwise yyparse() cannot be found. Not sure why the compiler did not complain about this.
I do have a working version. But removing the extern probably will make makefile not working.

@JRPan JRPan merged commit bc8061f into accel-sim:dev Apr 4, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants