Skip to content

Commit

Permalink
Add SST integration into gpgpusim (#44)
Browse files Browse the repository at this point in the history
* Add accommodations to run gpgpusim with SST simulation framework through balar

* Output setup_environment options when sourcing

* Add SST directive check when creating sim thread

* Add sst side test for jenkins

* sst-integration: update Jenkinsfile with offical sst-elements repo and fix bugs in pipeline script

* sst-integration: direct jenkins to rebuild gpgpusim before testing for sst

* sst-integration: fix bugs in sst repos config

* sst-integration: let Jenkins rebuilds simulator

Since the simulator needs to be configured with both normal mode and sst mode, need to rebuild make target to clean prior runs.

* sst-integration: Update Jenkinsfile to source env vars when running balar test

* sst-integration: refactor code to remove __SST__ flag

* sst-integration: fix a bug that init cluster twice for sst

* sst-integration: fix a bug of not sending mem packets to SST

* sst-integration: remove sst flags from makefiles and setup_env

* sst-integration: add comments to SST changes

* sst-integration: remove rebuilding simulator in jenkins when testing for SST

* sst-integration: revert simulator build script

* Add a function to support querying function argument info for SST

* sst-integration: add version detection for vanadis binary

* Automated Format

* add version detection support for gcc 10+

* sst-integration: add cudaMallocHost for SST

* sst-integration: fix a compilation bug

* sst-integration: add sst balar unittest CI

* sst-integration: specify GPU_ARCH for CI test

* sst-integration: use bash for github actions

* sst-integration: use https links for sst repos

* sst-integration: add SST dependencies to CI config

* sst-integration: remove sudo

* sst-integration: default to yes for apt install

* sst-integration: add manual trigger for github action

* sst-integration: remove wrong on event

* sst-integration: limit CPU usage for compilation

* sst-integration: fix wrong path

* sst-integration: use personal repo for testing

* sst-integration: remove sst-core source in CI to free space

* sst-integration: SST_Cycle use print stats with stream id

* Automated Format

* sst-integration: check for diskspace and try to clean it

* sst-integration: move out of docker image

* sst-integration: testing for ci path

* sst-integration: fix syntax

* sst-integration: pass env vars

* sst-integration: set env properly

* sst-integration: merge LLVM build and test into same job

* sst-integration: fix step order

* sst-integration: checkout correct branch for env-setup

* sst-integration: remove resourcing gpu apps

* sst-integration: revert back to docker github action

* sst-integration: enable debug trace for sst testing

* sst-integration: resourcing gpu app for env vars

* sst-integration: use GPUAPPS_ROOT for path for gpu app

* sst-integration: use GPUAPPS_ROOT for path for gpu app

* sst-integration: enable parallel ci tests and fix not returning with cudaMallocHostSST

* sst-integration: using debug flag for CI run

* sst-integration: revert debug ci run

* sst-integration: CI skips cuda sdk download and launch multiple jobs

* sst-integration: reenable parallel tests

* sst-integration: reduce concurrent test thread count

* sst-integration: skip long test for github runner

* sst-integration: try running CI with single core

* sst-integrtion: add callback to SST to check thread sync is done in SST_Cycle()

* sst-integration: ignore lookup if already found and add callbacks to SST

* Automated Format

* sst-integration: add support for indirect texture access

* Automated Format

* sste-integration: fix up for PR

* Automated Format

---------

Co-authored-by: purdue-jenkins <[email protected]>
  • Loading branch information
William-An and purdue-jenkins authored Dec 11, 2024
1 parent 667834c commit 752d4e5
Show file tree
Hide file tree
Showing 21 changed files with 1,176 additions and 86 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/sst_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Workflow with cmake build system
name: SST Integration Test

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the mydev branch
push:
branches-ignore:
- "gh-readonly-queue**"
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-QV100:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
# test_type: [simple, medium, long]
test_type: [simple, medium]
container:
image: tgrogers/accel-sim_regress:SST-Integration-Ubuntu-22.04-cuda-11.7-llvm-18.1.8-riscv-gnu-2024.08.06-nightly
env:
CONFIG: QV100
GPU_ARCH: sm_70

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Build GPGPU-Sim in SST mode
run: |
source ./setup_environment
make -j4
- name: Prepare SST dependencies
run: |
apt install -y openmpi-bin openmpi-common libtool libtool-bin autoconf python3 python3-dev automake build-essential git
# Use personal repo for now
- name: Build SST-Core
run: |
git clone https://github.com/William-An/sst-core.git
cd sst-core
git pull
git checkout devel
./autogen.sh
./configure --prefix=`realpath ../sstcore-install` --disable-mpi --disable-mem-pools
make -j4
make install
cd ..
rm -rf ./sst-core
# Use personal repo for now
- name: Build SST-Elements
run: |
git clone https://github.com/William-An/sst-elements.git
source ./setup_environment
cd sst-elements
git pull
git checkout balar-mmio-vanadis-llvm
./autogen.sh
./configure --prefix=`realpath ../sstelements-install` --with-sst-core=`realpath ../sstcore-install` --with-cuda=$CUDA_INSTALL_PATH --with-gpgpusim=$GPGPUSIM_ROOT
make -j4
make install
# Have to resource the gpu app
# Also fake a SDK since rodinia 2.0 does not need this, speed things up on github
- name: Balar Test
run: |
pip install testtools blessings pygments
source ./setup_environment
mkdir 4.2
mkdir fake_sdk
export NVIDIA_COMPUTE_SDK_LOCATION=$(readlink -f ./fake_sdk)
source $GPUAPPS_ROOT/src/setup_environment sst
rm -rf 4.2
rm -f gpucomputingsdk_4.2.9_linux.run
./sstcore-install/bin/sst-test-elements -w "*balar*${{ matrix.test_type }}*"
35 changes: 35 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,41 @@ pipeline {
ssh [email protected] "cd $PLOTDIR && rm -rf latest && cp -r ${BUILD_NUMBER} latest"'
}
}
stage('sst-core-build') {
steps {
sh 'rm -rf sstcore-install'
sh 'rm -rf sst-core && git clone [email protected]:sstsimulator/sst-core.git'
sh '''#!/bin/bash
cd sst-core
./autogen.sh
./configure --prefix=`realpath ../sstcore-install` --disable-mpi --disable-mem-pools
make -j 10
make install'''
}
}
stage('sst-elements-build') {
steps {
sh 'rm -rf sstelements-install'
sh 'rm -rf sst-elements && git clone [email protected]:sstsimulator/sst-elements.git'
// First sourcing the env_setup and setup_environment script for env vars
sh '''#!/bin/bash
source ./env-setup/11.0_env_setup.sh
source `pwd`/setup_environment
cd sst-elements
./autogen.sh
./configure --prefix=`realpath ../sstelements-install` --with-sst-core=`realpath ../sstcore-install` --with-cuda=$CUDA_INSTALL_PATH --with-gpgpusim=$GPGPUSIM_ROOT
make -j 10
make install'''
}
}
stage('sst balar test') {
steps {
sh '''#!/bin/bash
source ./env-setup/11.0_env_setup.sh
source `pwd`/setup_environment sst
./sstcore-install/bin/sst-test-elements -p ./sst-elements/src/sst/elements/balar/tests'''
}
}
}
post {
success {
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ INTERSIM ?= intersim2

include version_detection.mk

# Check for debug
ifeq ($(GPGPUSIM_CONFIG), gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug)
export DEBUG=1
else
Expand Down Expand Up @@ -168,6 +169,7 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.10.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.10.0; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.10.1 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.10.1; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.11.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.11.0; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart_mod.so ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart_mod.so; fi

$(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib
g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.1,-current_version,1.1\
Expand Down
17 changes: 17 additions & 0 deletions libcuda/cuda_api_object.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef __cuda_api_object_h__
#define __cuda_api_object_h__

#include <functional>
#include <list>
#include <map>
#include <set>
Expand Down Expand Up @@ -193,9 +194,25 @@ class cuda_runtime_api {
// backward pointer
class gpgpu_context *gpgpu_ctx;
// member function list

// For SST and other potential simulator interface
void cuobjdumpInit(const char *fn);
void extract_code_using_cuobjdump(const char *fn);
void extract_ptx_files_using_cuobjdump(CUctx_st *context, const char *fn);

// For running GPGPUSim alone
void cuobjdumpInit();
void extract_code_using_cuobjdump();
void extract_ptx_files_using_cuobjdump(CUctx_st *context);

// Internal functions for the above public methods
void cuobjdumpInit_internal(std::function<void()> ctx_extract_code_func);
void extract_code_using_cuobjdump_internal(
CUctx_st *context, std::string &app_binary,
std::function<void(CUctx_st *)> ctx_extract_ptx_func);
void extract_ptx_files_using_cuobjdump_internal(CUctx_st *context,
std::string &app_binary);

std::list<cuobjdumpSection *> pruneSectionList(CUctx_st *context);
std::list<cuobjdumpSection *> mergeMatchingSections(std::string identifier);
std::list<cuobjdumpSection *> mergeSections();
Expand Down
Loading

2 comments on commit 752d4e5

@Yfeng-44
Copy link

@Yfeng-44 Yfeng-44 commented on 752d4e5 Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @William-An , thanks for your efforts and contribution. This patch looks really interesting! May I ask: does this work under SASS-trace model too? when the last time I check with SST-balar (may be last year June), it mostly works under ptx mode.

@William-An
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yfeng, this is still running PTX simulation as on the SST side we are running an actual CUDA binary rather than trace files, with CPU part handled by Vanadis (a RISCV CPU model) and GPU part by GPGPU-Sim.

Please sign in to comment.