玩转 gpgpu-sim 01记 —— try it

2023-10-29 03:20
文章标签 玩转 01 try sim gpgpu

本文主要是介绍玩转 gpgpu-sim 01记 —— try it,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

官方文档:

GPGPU-Sim 3.x Manual

 

1. 短介绍

gpgpu-sim 是一个gpu模拟器,可以让cuda/openCL程序运行在一个软件模拟器上,而不需要硬件GPU;

2. 目标

用最简单省事的方式跑通一个gpgpu-sim的仿真

3. gpgpu-sim 一点项目特性

开发比较早,没有持续的维护,依赖的软件环境比较老,手动配置过程稍微复杂了,故采用docker image

4. 安装 docker engine

    4.1 安装

    4.2 拉取 docker image

sudo docker pull socalucr/gpgpu-sim

5. 启动一个容器

使用容器中自带的代码 :

export   NEW_DIR=gpgpu-sim_001     \
&&  export WORK_SPACE=/home/hipper/workspace/bitbucket   \
&&  mkdir -p   ${WORK_SPACE}/${NEW_DIR}    \
&&  cd ${WORK_SPACE}/${NEW_DIR}      \
&&  sudo docker run --name  ${NEW_DIR}_Jim -it                             \
-v  ${WORK_SPACE}/${NEW_DIR}:${WORK_SPACE}/${NEW_DIR}                   \
-v /dev:/dev -v /usr/src/:/usr/src -v /lib/modules/:/lib/modules --privileged --cap-add=ALL    \
socalucr/gpgpu-sim:latest    /bin/bash

 或者,git clone 一份新的代码:

export   NEW_DIR=gpgpu-sim_002     \
&&  export WORK_SPACE=/home/hipper/workspace/bitbucket   \
&&  mkdir -p   ${WORK_SPACE}/${NEW_DIR}    \
&&  cd ${WORK_SPACE}/${NEW_DIR}      \
&&  git clone --recursive https://github.com/gpgpu-sim/gpgpu-sim_distribution.git      \
&&  sudo docker run --name  ${NEW_DIR}_Jim -it                                                               \
-v  ${WORK_SPACE}/${NEW_DIR}:${WORK_SPACE}/${NEW_DIR}                                           \
-v  ${WORK_SPACE}/${NEW_DIR}/gpgpu-sim_distribution:/root/gpgpu-sim_distribution       \
-v /dev:/dev -v /usr/src/:/usr/src -v /lib/modules/:/lib/modules --privileged --cap-add=ALL    \
socalucr/gpgpu-sim:latest    /bin/bash

并将clone到的代码,checkout 出 3.2.2 版本的代码,方便访问代码:

git   checkout    24f29469c042761d8b8d185c374493fbde79aca4   -b   version_3.2.2

代码在容器里的  /root/gpgpu-sim_distribution

/root/ 下还有其他测试代码

6. 编译gpgpu-sim

在容器中,编译gpgpu-sim 并 拷贝 test配置文件:

# cd gpgpu-sim_distribution
# make clean
# source setup_environment
# make4) Copy configs eg. GTX480 and Run your benchmarks.
# mkdir ~/test
# cp configs/GTX480/* ~/test/.
# cd ~/test/

7. 运行 cuda程序

     7.1 编译ispass2009-benchmarks

先按照上述步骤编译gpgpu-sim,才能编译运行这些示例,运行时需要动态调用 libcudart.so.4

libcudart.so.4 => /root/gpgpu-sim_distribution/lib/gcc-4.4.7/cuda-4000/release/libcudart.so.4

# cd /root/ispass2009-benchmarks
# make -f Makefile.ispass-2009

    7.2 运行 RAY

测试一个光追程序 RAY,参数格式:

# RAY width  heighth

~/test# ~/ispass2009-benchmarks/bin/release/RAY 4 4~/test# cd
~# mkdir /root/test03
~# cd /root/test03/
~/test03# cp /root/gpgpu-sim_distribution/configs/GTX480/* ./
~/test03# ~/ispass2009-benchmarks/bin/release/RAY 640 640

  运行效果图:

7.3 编译 /root/NVIDIA_GPU_Computing_SDK/C

# cd /root/NVIDIA_GPU_Computing_SDK/C/
# make -j

7.4 运行 /root/NVIDIA_GPU_Computing_SDK/C/src/vectorAdd

# mkdir ~/test_vectorAdd_01
# cd ~/test_vectorAdd_01/
# cp ~/gpgpu-sim_distribution/configs/GTX480/* ./
root@c07a3d14ebcb:~/test_vectorAdd_01# /root/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/vectorAdd

 运行结果

参考文档:

https://socal-ucr.github.io/GPGPU-sim-container/

Setup
1) Install docker by following the instructions in official Docker documentation.
2) Use the command $ docker run -w /root -it socalucr/gpgpu-sim /bin/bash # Start a new container of GPGPU-sim
3) $ cd gpgpu-sim_distribution; make clean; source setup_environment; make
4) Copy configs eg. GTX480 and Run your benchmarks.
- mkdir ~/test
- cp configs/GTX480/* ~/test/.
- cd ~/test/
- ~/ispass2009-benchmarks/bin/release/RAY 4 4NOTE: If you want to detach (push it to background) from the container without shutting it down, use ctrl+p+q Remember that $ exit would shutdown the container.Useful Docker commands$ docker images # lists all locally available images
$ docker ps # list all up and running containers.
$ docker ps -a # list all exited, errored and running containers.
$ docker start CONTAINER_ID # Command to start the container when exited accidentally.
$ docker run IMAGE_NAME # Start a new container of IMAGE_NAME
$ docker attach CONTAINER_ID # Reattach to running (detached) container.
# docker rmi IMAGE_NAME # Remove locally available image.Any questions?
krang006@ucr.edu
mchow009@ucr.edu

这篇关于玩转 gpgpu-sim 01记 —— try it的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/297928

相关文章

Python中 try / except / else / finally 异常处理方法详解

《Python中try/except/else/finally异常处理方法详解》:本文主要介绍Python中try/except/else/finally异常处理方法的相关资料,涵... 目录1. 基本结构2. 各部分的作用tryexceptelsefinally3. 执行流程总结4. 常见用法(1)多个e

如何通过try-catch判断数据库唯一键字段是否重复

《如何通过try-catch判断数据库唯一键字段是否重复》在MyBatis+MySQL中,通过try-catch捕获唯一约束异常可避免重复数据查询,优点是减少数据库交互、提升并发安全,缺点是异常处理开... 目录1、原理2、怎么理解“异常走的是数据库错误路径,开销比普通逻辑分支稍高”?1. 普通逻辑分支 v

python使用try函数详解

《python使用try函数详解》Pythontry语句用于异常处理,支持捕获特定/多种异常、else/final子句确保资源释放,结合with语句自动清理,可自定义异常及嵌套结构,灵活应对错误场景... 目录try 函数的基本语法捕获特定异常捕获多个异常使用 else 子句使用 finally 子句捕获所

解决mysql插入数据锁等待超时报错:Lock wait timeout exceeded;try restarting transaction

《解决mysql插入数据锁等待超时报错:Lockwaittimeoutexceeded;tryrestartingtransaction》:本文主要介绍解决mysql插入数据锁等待超时报... 目录报错信息解决办法1、数据库中执行如下sql2、再到 INNODB_TRX 事务表中查看总结报错信息Lock

hdu 2602 and poj 3624(01背包)

01背包的模板题。 hdu2602代码: #include<stdio.h>#include<string.h>const int MaxN = 1001;int max(int a, int b){return a > b ? a : b;}int w[MaxN];int v[MaxN];int dp[MaxN];int main(){int T;int N, V;s

集中式版本控制与分布式版本控制——Git 学习笔记01

什么是版本控制 如果你用 Microsoft Word 写过东西,那你八成会有这样的经历: 想删除一段文字,又怕将来这段文字有用,怎么办呢?有一个办法,先把当前文件“另存为”一个文件,然后继续改,改到某个程度,再“另存为”一个文件。就这样改着、存着……最后你的 Word 文档变成了这样: 过了几天,你想找回被删除的文字,但是已经记不清保存在哪个文件了,只能挨个去找。真麻烦,眼睛都花了。看

秒变高手:玩转CentOS 7软件更换的方法大全

在 CentOS 7 中更换软件源可以通过以下步骤完成。更换源可以加快软件包的下载速度,特别是当默认源速度较慢时。以下是详细步骤: 前言 为了帮助您解决在使用CentOS 7安装不了软件速度慢的问题,我们推出了这份由浪浪云赞助的教程——“CentOS7如何更换软件源加快下载速度”。 浪浪云,以他们卓越的弹性计算、云存储和网络服务受到广泛好评,他们的支持和帮助使得我们可以将最前沿的技术知识分

01 Docker概念和部署

目录 1.1 Docker 概述 1.1.1 Docker 的优势 1.1.2 镜像 1.1.3 容器 1.1.4 仓库 1.2 安装 Docker 1.2.1 配置和安装依赖环境 1.3镜像操作 1.3.1 搜索镜像 1.3.2 获取镜像 1.3.3 查看镜像 1.3.4 给镜像重命名 1.3.5 存储,载入镜像和删除镜像 1.4 Doecker容器操作 1.4

C++第四十七弹---深入理解异常机制:try, catch, throw全面解析

✨个人主页: 熬夜学编程的小林 💗系列专栏: 【C语言详解】 【数据结构详解】【C++详解】 目录 1.C语言传统的处理错误的方式 2.C++异常概念 3. 异常的使用 3.1 异常的抛出和捕获 3.2 异常的重新抛出 3.3 异常安全 3.4 异常规范 4.自定义异常体系 5.C++标准库的异常体系 1.C语言传统的处理错误的方式 传统的错误处理机制:

try -catch-finally的理解,同时在try-catch-finally中含有return和throws的理解

在没有try-catch或try-catch-finally的情况下,程序正常执行到某行,在这行报错后,这行后面的代码就不执行了,程序就停止了,中断了。 例如   在有try-catch或try-catch-finally 情况上,在某行执行错误,在try中这行下的代码不执行,try外的代码执行。当然是catch在没有做处理的情况下。如果catch中做了处理,在不影响当前程序下,try