Fix kernel attribute query when cuLaunchKernel uses CUkernel handles (#521)
tracer_nvbit: fall back to cuKernelGetAttribute for kernel attrs
format tracer tool code
Co-authored-by: WilliamMTK China_Aisa@live.com Co-authored-by: JRPan 25518778+JRPan@users.noreply.github.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Welcome to the top-level repo of Accel-Sim and AccelWattch
The ISCA 2020 paper describes the goals of Accel-Sim and introduces the tool. This readme is meant to provide tutorial-like details on how to use the Accel-Sim framework. If you use any component of Accel-Sim, please cite:
This repository also includes AccelWattch: A Power Modeling Framework for Modern GPUs. The MICRO 2021 paper introduces AccelWattch. Please look at our AccelWattch MICRO’21 Artifact Manual for detailed information on various AccelWattch components. For information on just running AccelWattch, please look at the AccelWattch Overview section in this read-me. If you use any component of AccelWattch, please cite:
Dependencies
This package is meant to be run on a modern linux distro. A docker image that works with this repo can be found here. The dockerfile used to build this image can be found here, which built on top of
nvidia/cuda:12.8.0-cudnn-devel-ubuntu24.04.To build on local machine, install the following packages with CUDA toolkit:
Overview
The code for the Accel-Sim and AccelWattch frameworks are in this repo. Accel-Sim 1.0 uses the GPGPU-Sim 4.0 performance model, which was released as part of the original Accel-Sim paper. Building the trace-based Accel-Sim will pull the right version of GPGPU-Sim 4.0 and the AccelWattch power model to use in Accel-Sim. AccelWattch replaces the GPUWattch power model in GPGPU-Sim 4.0.
There is an additional repo where we have collected a set of common GPU applications and a common infrastructure for building them with different versions of CUDA. If you use/extend this app framework, it makes Accel-Sim easily usable with a few simple command lines. The instructions in this README will take you through how to use Accel-Sim with the apps in from this collection as well as just on your own, with your own apps.
GPU App Collection
AccelWattch microbenchmarks and AccelWattch validation set benchmarks are also included. For more information on these benchmarks, please look at our MICRO 2021 paper and AccelWattch MICRO’21 Artifact Manual.
Accel-Sim Components
Accel-Sim Tracer
An NVBit tool for generating SASS traces from CUDA applications. Code for the tool lives in
./util/tracer_nvbit/. To make the tool:A simple example
The following example demonstrates how to trace the simple rodinia functional tests that get run in our travis regressions:
That’s it. The traces for the short-running rodinia tests will be generated in:
To extend the tracer, use other apps and understand what, exactly is going on, read this.
Spinlock handling
If your application contains spinlock instructions, you can handle them with the tracer by using the following command:
This will fast forward the spinlock instructions and keep the spinlock instructions for the number of iterations specified in the
--spinlock_fast_forward_iterationsarg option.The tool for spinlock detection is in
./util/tracer_nvbit/others/spinlock_tool/.Pre-traced applications
For convience, we have included a repository of pre-traced applications - to get all those traces, simply run:
and follow the instructions.
Accel-Sim SASS Frontend and Simulation Engine
A simulator frontend that consumes SASS traces and feeds them into a performance model. The intial release of Accel-Sim coincides with the release of GPGPU-Sim 4.0, which acts as the detailed performance model. To build the Accel-Sim simulator that uses the traces, do the following:
This will produce an executable in:
Running the simple example in the tracer section:
The above command will run the workloads in Accel-Sim’s SASS traces-driven mode. You can also run the workloads in PTX mode using:
Eg:
You can monitor the tests using:
After the jobs finish - you can collect all the stats using:
If you want to run the accel-sim.out executable command itself for specific workload, you can use:
However, we encourage you to use our workload launch manager ‘run_simulations’ script as shown above, which will greatly simplify the simulation process and increase productivity.
To understand what is going on and how to just run the simulator in isolation without the framework, read this.
To better undersatnd the Accel-Sim front-end and the interface with GPGPU-Sim, read this.
Accel-Sim Correlator
A tool that matches, plots and correlates statistics from the performance model with real hardware statistics generated by profiling tools. To use the correlator, you must first generate hardware output and simulation statistics. To generate output from the GPU, use the scripts in ./util/hw_stats. For example, to generate the profiler numbers for the short-running apps in our running example, do the following:
All the stats will be output in:
However - we also provide a comprehensive suite of hardware profiling results, which can be obtained by running:
Now you can use the statistics from the simulation run you did in (2) to correlate with these results. To generate stats that can be correlated - do the following:
To run the correlator - do the following:
The script may take a few minutes to run (primarily because it is parsing a large amount of hardware data for >150 apps). Stdout will print the summary of counters error, correlation, etc. and a set of correlation plots will be generated in:
Here you will find interactive HTML plots, csvs and textual summaries of how well the simulator correlated against hardware on both a per-kernel and per-app basis. Note that the simple tests we ran in this tutorial are short running and not generally representative of scaled GPU apps and are just meant to quickly validate you can get Accel-Sim working. For a true validation, you should attempt correlating the fully-scaled set of apps used in the paper. These will take hours to run (even on a cluster), and some consume significant memory, but can be run using:
Accel-Sim Tuner
An automated tuner that automates configuration file generation from a detailed microbenchmark suite. You need to provide a C header file
hw_defthat contains minimal information about the hardware model. This file is used to configure and tune the microbenchmarks for the unduerline hardware. See an example of Ampere RTX 3060 card here. Then, compile and run the microbenchmarks and the tuner:The tuner.py script will parse the microbenchmarks output and generate a folder with the same device name (e.g. “RTX_3060”). The folder will contain the config files for GPGPU-Sim performance model and Accel-Sim trace-driven front-end that matche and model the underline hardware as much as possible. For more detilas about the Accel-Sim tuner and the microbemcakring suite, read this.
How do I quickly just run what GitHub action runs?
Install docker, then simply run:
If something is dying and you want to debug it - you can always run it in interactive mode:
Then from within the docker run:
You can also play around and do stuff inside the image (even debug the simulator) - if you want to do this, installing gdb will help:
Don’t want to install docker? Just use a linux distro with the packages detailed in dependencies, set
CUDA_INSTALL_PATH./short-tests.sh, the run./short-tests.sh.AccelWattch Overview
Running AccelWattch SASS SIM: To run the simple example from bullet 1 with AccelWattch power estimations enabled using the AccelWattch SASS SIM model,
This will use the AccelWattch SASS SIM xml configuration file for the power model. The configuration files for the AccelWattch power model presented in our MICRO 2021 paper can be found here. Please look at
./util/job_launching/configs/define-standard-cfgs.ymlfor a list of provided AccelWattch configurations. The AccelWattch HYBRID configuration provided there uses activity factors for L2 and NOC from Accel-Sim and the rest from hardware performance counters. You can create your own AccelWattch HYBRID configuration in this file with a different mix of AccelWattch activity factors from Accel-Sim and hardware execution. Upon completion of simulations, AccelWattch power estimations are stored in a accelwattch_power_report.log in a per-kernel format in the run directory.Running AccelWattch HW or AccelWattch HYBRID: To run the simple example from bullet 1 with AccelWattch HW or AccelWattch HYBRID configurations,
Note that AccelWattch HW and AccelWattch HYBRID configurations require hardware performance counter information for the target application stored in a hw_perf.csv file in the run directory. A sample hw_perf.csv file with performance counter information collected from a GV100 card for validation suite benchmarks used in our MICRO 2021 paper is copied over to the run directory by default with the above run_simulations.py command. The -a argument for run_simulations.py is used to feed the application name to AccelWattch. Please make sure that there is a hardware performance counter information entry with the same application name in hw_perf.csv for AccelWattch to obtain activity factors from. Please look at example entries in the provided
./util/accelwattch/accelwattch_hw_profiler/hw_perf.csv.Running AccelWattch PTX SIM: To run the simple example from bullet 1 with AccelWattch power estimations enabled using the AccelWattch PTX SIM model,
Hardware Power and Performance Profiler: The AccelWattch hardware profiler scripts are located at
./util/accelwattch/accelwattch_hw_profiler/in this repository. For more information on how to use them, please look at this section in our MICRO’21 Artifact Manual.Microbenchmarks and Quadratic Optimization Solver: The source code for the microbenchmarks used for AccelWattch dynamic power modeling are located here and can be compiled by following the README here. The Quadratic Optimization Solver MATLAB script is located at
./util/accelwattch/quadprog_solver.m.SASS to Power Component Mapping: The header file
gpu-simulator/ISA_Def/accelwattch_component_mapping.hcontains the Accel-Sim instruction opcode to AccelWattch power component mapping and can be extended to support new SASS instructions for future architectures. Please look at the opcode.h files for respective GPU Architectures in the same directorygpu-simulator/ISA_Def/for SASS instruction to Accel-Sim opcode mapping.