玩转 gpgpu sim 02记 —— 构建了什么

news2024/11/22 8:58:01

1. 设置环境变量

编译gpgpu-sim 需要先运行脚本 setup_environment , source setup_environment, 注释如下,主要是设置一些 Makefile中会用到的环境变量

# see README before running this
# 下面这句用来检测当前的shell环境是不是 bash 或者 sh 或者 zsh,不支持除三者之外的其他 shell
ps -p $$ | awk '/bash/ || / sh/ || /zsh/ {exit 1;}' && echo "ERROR ** source setup_environment must be run in a bash, zsh or sh shell; see README" && exit

# 下面这变量用来标识 成功运行过了 source setup_environment,并在本脚本末尾将这个变量置 1;
export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=
# 下面,将本脚本所在的路径赋值给 GPGPUSIM_ROOT
export GPGPUSIM_ROOT="$( cd "$( dirname "$BASH_SOURCE" )" && pwd )"
# 下面,通过源代码根目录下的 version 文件中的内容,获得gpgp-sim的版本号,存储于 GPGPUSIM_VERSION_STRING;而变量 GPGPUSIM_BUILD_STRING 将根据 version 的文件内容而获得空值;
GPGPUSIM_VERSION_STRING=`cat $GPGPUSIM_ROOT/version | awk '/Version/ {print $8}'`
GPGPUSIM_BUILD_STRING=`cat $GPGPUSIM_ROOT/version | awk '/Change/ {print $6}'`
# 下面,将在终端中输出这两个变量的值,作为提示信息;
echo -n "GPGPU-Sim version $GPGPUSIM_VERSION_STRING (build $GPGPUSIM_BUILD_STRING) ";

# 下面,错误检查;判断 CUDA_INSTALL_PATH 是否为空;这是一个需要根据本机的 cuda 环境信息预先设置的变量,一般是 export CUDA_INSTALL_PATH=/usr/local/cuda
if [ ! -n "$CUDA_INSTALL_PATH" ]; then
	echo "ERROR ** Install CUDA Toolkit and set CUDA_INSTALL_PATH.";
	return;
fi
# 下面,错误检查;判断 CUDA_INSTALL_PATH 所表示的文件夹在系统中是否确实存在
if [ ! -d "$CUDA_INSTALL_PATH" ]; then
	echo "ERROR ** CUDA_INSTALL_PATH=$CUDA_INSTALL_PATH invalid (directory does not exist)";
	return;
fi
# 下面,错误检查;gpgpu-sim 仅支持 Linux 和 Mac OS 系统, 如果不是在这两种 OS 运行此脚本则退出;意味着 GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN 将不会被置1;
if [ ! `uname` = "Linux" -a  ! `uname` = "Darwin" ]; then
	echo "ERROR ** Unsupported platform: GPGPU-Sim $GPGPUSIM_VERSION_STRING developed and tested on Linux."
	return;
fi
# 下面,去掉PATH中 跟cuda 和 gpgp-sim 相关的路径;防止多次运行本脚本时,会使得PATH内容不断重复变长,影响性能,挑战极限;
export PATH=`echo $PATH | sed "s#$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:##"`
# 下面,在PATH中加入跟cuda 和 gpgpu-sim相关的路径;
export PATH=$GPGPUSIM_ROOT/bin:$CUDA_INSTALL_PATH/bin:$PATH


# to run the debug build of GPGPU-Sim run:
# source setup_environment debug
# 下面,设置 NVCC_PATH 为 nvcc 的全路径,例如常常是 /usr/local/cuda/bin/nvcc
NVCC_PATH=`which nvcc`;
# 下面,错误检查;如果PATH所记录的路径下找不到nvcc这个程序,那么系统将返回非0值,可用echo $? 查看具体数值;
if [ $? = 1 ]; then
	echo "";
	echo "ERROR ** nvcc (from CUDA Toolkit) was not found in PATH but required to build GPGPU-Sim.";
	echo "         Try adding $CUDA_INSTALL_PATH/bin/ to your PATH environment variable.";
	echo "         Please also be sure to read the README file if you have not done so.";
	echo "";
	return;
fi
# 下面,从gcc --version 返回的文本的第一行中,抓出当前 gcc 的版本号
CC_VERSION=`gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(match($i,/^[0-9]\.[0-9]\.[0-9]$/))  {print $i; exit 0}}}'`

# 下面,跟上一个类似,从nvcc --version 的返回文本中获得 nvcc 的版本号, 这个docker image 中分别是 4.0 和 4000
CUDA_VERSION_STRING=`$CUDA_INSTALL_PATH/bin/nvcc --version | awk '/release/ {print $5;}' | sed 's/,//'`;
CUDA_VERSION_NUMBER=`echo $CUDA_VERSION_STRING | sed 's/\./ /' | awk '{printf("%02u%02u", 10*int($1), 10*$2);}'`
# 下面,版本号检查,2030 ~ 4020 之间
if [ $CUDA_VERSION_NUMBER -gt 4020 -o $CUDA_VERSION_NUMBER -lt 2030  ]; then
	echo "ERROR ** GPGPU-Sim version $GPGPUSIM_VERSION_STRING not tested with CUDA version $CUDA_VERSION_STRING (please see README)";
	return;
fi
# 下面,没有参数,故$#==0;所以 GPGPUSIM_CONFIG=gcc-4.4.7/cuda-4000/release; $1= debug, release
if [ $# = '1' ] ;
then
    export GPGPUSIM_CONFIG=gcc-$CC_VERSION/cuda-$CUDA_VERSION_NUMBER/$1
else
    export GPGPUSIM_CONFIG=gcc-$CC_VERSION/cuda-$CUDA_VERSION_NUMBER/release
fi

# 下面,这个变量没用
export QTINC=/usr/include
# 下面,试图设置 libOpenCL.so 和 cl.h 文件所在的路径,存储于变量 NVOPENCL_LIBDIR 和 NVOPENCL_INCDIR 中;
# change NVOPENCL_LIBDIR to point to your opencl library directory, usually
# /usr/lib or /usr/lib64. Not setting this variable will cause gpgpu-sim to
# build without opencl support.
if [ -f /usr/lib64/libOpenCL.so ]; then
	export NVOPENCL_LIBDIR=/usr/lib64;

	# change NVOPENCL_INCDIR to point to your opencl include directory.
	if [ -f /usr/include/CL/cl.h ]; then
		export NVOPENCL_INCDIR=/usr/include/;
	elif [ -f $CUDA_INSTALL_PATH/include/CL/cl.h ]; then
		export NVOPENCL_INCDIR=$CUDA_INSTALL_PATH/include/;
	fi
fi
# 下面,设置 LD_LIBRARY_PATH 的值,通过LD_LIBRARY_PATH修改依赖的动态库,会话全局有效;防止多次运行 本脚本,故先尝试删掉;但这里的方式是无效的,多次运行会导致变量值越来越长;
# 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.
if [ `uname` = "Darwin" ]; then
	export DYLD_LIBRARY_PATH=`echo $DYLD_LIBRARY_PATH | sed -Ee 's#'$GPGPUSIM_ROOT'\/lib\/[0-9]+\/(debug|release):##'`
	export DYLD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$DYLD_LIBRARY_PATH
else
	export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed -re 's#'$GPGPUSIM_ROOT'\/lib\/[0-9]+\/(debug|release):##'`
	export LD_LIBRARY_PATH=$GPGPUSIM_ROOT/lib/$GPGPUSIM_CONFIG:$LD_LIBRARY_PATH
fi

# 下面,OpenCL 先不管,远程调用NV 的 OpenCL 环境
# The following sets OPENCL_REMOTE_GPU_HOST which is used by GPGPU-Sim to
# SSH to remote node to generate PTX for OpenCL kernels when running on 
# a node that does not have an NVIDIA driver installed.
# The remote node should have GPGPU-Sim installed at the same path
if [ `uname` = "Darwin" ]; then
	HOSTNAME_PREFIX=`hostname -s`;
	export HOSTNAME_DOMAIN=`hostname | sed s/$HOSTNAME_PREFIX\.//`;
else
	HOSTNAME_DOMAIN=`hostname -d`
fi
if [ "x$HOSTNAME_DOMAIN" = "xece.ubc.ca" -a "$OPENCL_REMOTE_GPU_HOST" = "" ]; then
	export OPENCL_REMOTE_GPU_HOST=aamodt-pc05.ece.ubc.ca
fi
HOSTNAME_F=`hostname -f`
if [ "x$HOSTNAME_F" = "x$OPENCL_REMOTE_GPU_HOST" ]; then
	unset OPENCL_REMOTE_GPU_HOST
fi
# 下面,如果发现文件 gpgpu_sim.verify 存在,则证明 gpuwattch 文件夹存在,则指定 GPGPUSIM_POWER_MODEL 的值;后面两个 elif 是错误检查;
# The following checks to see if the GPGPU-Sim power model is enabled.
# GPGPUSIM_POWER_MODEL points to the directory where gpgpusim_mcpat is located.
# If this is not set, it checks the default directory "$GPGPUSIM_ROOT/src/gpuwattch/".
if [ -d $GPGPUSIM_ROOT/src/gpuwattch/ ]; then
	if [ ! -f $GPGPUSIM_ROOT/src/gpuwattch/gpgpu_sim.verify ]; then
		echo "ERROR ** gpgpu_sim.verify not found in $GPGPUSIM_ROOT/src/gpuwattch";
		return;
	fi
	export GPGPUSIM_POWER_MODEL=$GPGPUSIM_ROOT/src/gpuwattch/;
	echo "configured with GPUWattch.";
elif [ -n "$GPGPUSIM_POWER_MODEL" ]; then
	if [ ! -f $GPGPUSIM_POWER_MODEL/gpgpu_sim.verify ]; then
		echo "";
		echo "ERROR ** gpgpu_sim.verify not found in $GPGPUSIM_ROOT/src/gpuwattch/ - Either incorrect directory or incorrect McPAT version";
		return;
	fi
	echo "configure with power model in $GPGPUSIM_POWER_MODEL.";
elif [ ! -d $GPGPUSIM_POWER_MODEL ]; then
		echo "";
		echo "ERROR ** GPGPUSIM_POWER_MODEL ($GPGPUSIM_POWER_MODEL) does not exist... Please set this to the gpgpusim_mcpat directory or unset this environment variable.";
		return;
else
	echo "configured without a power model.";
fi

echo "setup_environment succeeded";
# 下面,变量置1, 向 Makefile 说明成功运行过了 setup_environment 脚本
export GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN=1

2.  一览

示例程序 RAY 运行时 调用了 gpgpu-sim 的什么内容

01记中,在容器中运行了 示例程序 RAY,现在在容器中查看其依赖:

# ldd /root/ispass2009-benchmarks/bin/release/RAY

可以发现,与gpgpu-sim 相关的是 libcudart.so.4 存储在:

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

3. gpgpu-sim 的 Makefile

3.1 顶层 Makefile 注释如下

/root/gpgpu-sim_distribution/Makefile

非常短,总共200多行

# Copyright (c) 2009-2011, Tor M. Aamodt, Ali Bakhoda, Timothy Rogers, 
# Jimmy Kwa, and The University of British Columbia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
# Neither the name of The University of British Columbia nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# comment out next line to disable OpenGL support
# export OPENGL_SUPPORT=1
#下面,如果变量之前没有赋值的话,在这里赋值为 intersim2
# (Temp) Using intersim2 by deafult, to use intersim, type make INTERSIM=intersim
INTERSIM ?= intersim2
#下面,定义了 6 个变量, cuda 版本,gpgpu-sim 版本,gcc 版本, g++ 版本,以及存放中间文件的 build 路径
include version_detection.mk
#下面,判断 gpgpu-sim 构建类型为 debug 还是 release,并决定是否在 CXXFLAG 中使用 -g 还是 -O3
ifeq ($(GPGPUSIM_CONFIG), gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug)
	export DEBUG=1
else
	export DEBUG=0
endif
#下面,设置 BUILD_ROOT 的值为 Makefile 所在的路径
BUILD_ROOT?=$(shell pwd)
#下面,会导致编译子模块的时候,在编译器的类似 CXXFLAG 中定义一个宏,作为 cpp 代码的开关
export TRACE?=1
#下面,又又设置一遍 NVCC_PATH
NVCC_PATH=$(shell which nvcc)
#下面,设置两个文件夹的路径的变量,分别保存中间文件,和结果文件 libcudart.so
ifneq ($(shell which nvcc), "")
	ifeq ($(DEBUG), 1)
		export SIM_LIB_DIR=lib/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug
		export SIM_OBJ_FILES_DIR=$(BUILD_ROOT)/build/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/debug
	else
		export SIM_LIB_DIR=lib/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/release
		export SIM_OBJ_FILES_DIR=$(BUILD_ROOT)/build/gcc-$(CC_VERSION)/cuda-$(CUDART_VERSION)/release
	endif
endif
#下面,定义变量 LIBS,包括 4 个库文件
# cuda-sim 跟 ptx 相关的cuda 源码解析器?
# gpgpu-sim_uarch 关联到要建立 gpgpu-sim 仿真器核心lib的文件夹
LIBS = cuda-sim gpgpu-sim_uarch $(INTERSIM) gpgpusimlib 

#下面,TARGETS 的内容是本顶层 Makefile 的终极目标的依赖,所以,会被构建系统首先构建;
# TARGETS 包含了 libcudart.so, libOpenCL.so, cuobjdump_to_ptxplus
TARGETS =
ifeq ($(shell uname),Linux)
	TARGETS += $(SIM_LIB_DIR)/libcudart.so
else # MAC
	TARGETS += $(SIM_LIB_DIR)/libcudart.dylib
endif
#下面,向 TARGETS 中添加依赖
ifeq  ($(NVOPENCL_LIBDIR),)
	TARGETS += no_opencl_support
else ifeq ($(NVOPENCL_INCDIR),)
	TARGETS += no_opencl_support
else
	TARGETS += $(SIM_LIB_DIR)/libOpenCL.so
endif
	TARGETS += cuobjdump_to_ptxplus/cuobjdump_to_ptxplus

#下面,其实是 gpuwattch 的构建中间文件目录,会构建出 app mcpat:/root/gpgpu-sim_distribution/build/gcc-4.4.7/cuda-4000/release/gpuwattch/mcpat
MCPAT=
MCPAT_OBJ_DIR=
MCPAT_DBG_FLAG=
ifneq ($(GPGPUSIM_POWER_MODEL),)
	LIBS += mcpat


	ifeq ($(DEBUG), 1)
		MCPAT_DBG_FLAG = dbg
	endif

	MCPAT_OBJ_DIR = $(SIM_OBJ_FILES_DIR)/gpuwattch

	MCPAT = $(MCPAT_OBJ_DIR)/*.o
endif

#下面,gpgpusim 是这个Makefile的终极目标,它有4个依赖 check_setup_environment check_power makedirs $(TARGETS)
.PHONY: check_setup_environment check_power
gpgpusim: check_setup_environment check_power makedirs $(TARGETS)

# 下面,设置了 NVCC_PATH=/usr/local/cuda/bin/nvcc
# 检查三个环境变量是否非空,任意一个为空,则退出构建;若皆不为空,则说明 前面运行 source setup_environment 是成功的;
# 接下来会设置 NVCC_PATH, 是 nvcc 编译器程序的绝对地址(其实之前设置过了);若设置成功就打印输出一句话:Building GPGPU-Sim version 3.2.2 (build ) with CUDA version 4.0
check_setup_environment:
	 @if [ ! -n "$(GPGPUSIM_ROOT)" -o ! -n "$(CUDA_INSTALL_PATH)" -o ! -n "$(GPGPUSIM_SETUP_ENVIRONMENT_WAS_RUN)" ]; then \
		echo "ERROR *** run 'source setup_environment' before 'make'; please see README."; \
		exit 101; \
	 else \
		NVCC_PATH=`which nvcc`; \
		if [ $$? = 1 ]; then \
			echo ""; \
			echo "ERROR ** nvcc (from CUDA Toolkit) was not found in PATH but required to build GPGPU-Sim."; \
			echo "         Try adding $(CUDA_INSTALL_PATH)/bin/ to your PATH environment variable."; \
			echo "         Please also be sure to read the README file if you have not done so."; \
			echo ""; \
			exit 102; \
		else \
			echo; echo "	Building GPGPU-Sim version $(GPGPUSIM_VERSION) (build $(GPGPUSIM_BUILD)) with CUDA version $(CUDA_VERSION_STRING)"; echo; \
	 		true; \
		fi \
	 fi 
#下面,检查 gpuwattch 的相关变量 GPGPUSIM_POWER_MODEL 是否设置成功;
check_power:
	@if [ -d "$(GPGPUSIM_ROOT)/src/gpuwattch/" -a ! -n "$(GPGPUSIM_POWER_MODEL)" ]; then \
		echo ""; \
		echo "	Power model detected in default directory ($(GPGPUSIM_ROOT)/src/gpuwattch) but GPGPUSIM_POWER_MODEL not set."; \
		echo "	Please re-run setup_environment or manually set GPGPUSIM_POWER_MODEL to the gpuwattch directory if you would like to include the GPGPU-Sim Power Model."; \
		echo ""; \
		true; \
	elif [ ! -d "$(GPGPUSIM_POWER_MODEL)" ]; then \
		echo ""; \
		echo "ERROR ** Power model directory invalid."; \
		echo "($(GPGPUSIM_POWER_MODEL)) is not a valid directory."; \
		echo "Please set GPGPUSIM_POWER_MODEL to the GPGPU-Sim gpuwattch directory."; \
		echo ""; \
		exit 101; \
	elif [ -n "$(GPGPUSIM_POWER_MODEL)" -a ! -f "$(GPGPUSIM_POWER_MODEL)/gpgpu_sim.verify" ]; then \
		echo ""; \
		echo "ERROR ** Power model directory invalid."; \
		echo "gpgpu_sim.verify not found in $(GPGPUSIM_POWER_MODEL)."; \
		echo "Please ensure that GPGPUSIM_POWER_MODEL points to a valid gpuwattch directory and that you have the correct GPGPU-Sim mcpat distribution."; \
		echo ""; \
		exit 102; \
	fi
#下面,打印输出不支持 OpenCL 的信息;
no_opencl_support:
	@echo "Warning: gpgpu-sim is building without opencl support. Make sure NVOPENCL_LIBDIR and NVOPENCL_INCDIR are set"
#下面,目标 libcudart.so 的构建规则
$(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
	g++ -shared -Wl,-soname,libcudart.so \
			$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
			$(SIM_OBJ_FILES_DIR)/gpgpu-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/$(INTERSIM)/*.o \
			$(SIM_OBJ_FILES_DIR)/*.o -lm -lz -lGL -pthread \
			$(MCPAT) \
			-o $(SIM_LIB_DIR)/libcudart.so
	if [ ! -f $(SIM_LIB_DIR)/libcudart.so.2 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.2; fi
	if [ ! -f $(SIM_LIB_DIR)/libcudart.so.3 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.3; fi
	if [ ! -f $(SIM_LIB_DIR)/libcudart.so.4 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.4; fi
#下面,如果是在 Mac OS 中,目标 libcudart.dylib 的构建规则
$(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\
			$(SIM_OBJ_FILES_DIR)/libcuda/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
			$(SIM_OBJ_FILES_DIR)/gpgpu-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/$(INTERSIM)/*.o  \
			$(SIM_OBJ_FILES_DIR)/*.o -lm -lz -pthread \
			$(MCPAT) \
			-o $(SIM_LIB_DIR)/libcudart.dylib
#下面,目标 libOpenCL.so 的构建规则
$(SIM_LIB_DIR)/libOpenCL.so: makedirs $(LIBS) opencllib
	g++ -shared -Wl,-soname,libOpenCL.so \
			$(SIM_OBJ_FILES_DIR)/libopencl/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table/*.o \
			$(SIM_OBJ_FILES_DIR)/gpgpu-sim/*.o \
			$(SIM_OBJ_FILES_DIR)/$(INTERSIM)/*.o \
			$(SIM_OBJ_FILES_DIR)/*.o -lm -lz -lGL -pthread \
			$(MCPAT) \
			-o $(SIM_LIB_DIR)/libOpenCL.so 
	if [ ! -f $(SIM_LIB_DIR)/libOpenCL.so.1 ]; then ln -s libOpenCL.so $(SIM_LIB_DIR)/libOpenCL.so.1; fi
	if [ ! -f $(SIM_LIB_DIR)/libOpenCL.so.1.1 ]; then ln -s libOpenCL.so $(SIM_LIB_DIR)/libOpenCL.so.1.1; fi
#下面,目标cudalib 的构建规则
cudalib: makedirs cuda-sim
	$(MAKE) -C ./libcuda/ depend
	$(MAKE) -C ./libcuda/
#下面,目标 mcpat 的构建规则
ifneq ($(GPGPUSIM_POWER_MODEL),)
mcpat: makedirs
	$(MAKE) -C $(GPGPUSIM_POWER_MODEL) depend
	$(MAKE) -C $(GPGPUSIM_POWER_MODEL) $(MCPAT_DBG_FLAG)
endif
#下面,构建 cuda-sim 库
cuda-sim: makedirs
	$(MAKE) -C ./src/cuda-sim/ depend
	$(MAKE) -C ./src/cuda-sim/
#下面,构建 gpgpu-sim 核心库,以及依赖
gpgpu-sim_uarch: makedirs cuda-sim
	$(MAKE) -C ./src/gpgpu-sim/ depend
	$(MAKE) -C ./src/gpgpu-sim/
#下面,
$(INTERSIM): makedirs cuda-sim gpgpu-sim_uarch
	$(MAKE) "CREATE_LIBRARY=1" "DEBUG=$(DEBUG)" -C ./src/$(INTERSIM)
#下面,构建 gpgpu-sim 核心库及其相关库,以及依赖
gpgpusimlib: makedirs cuda-sim gpgpu-sim_uarch $(INTERSIM)
	$(MAKE) -C ./src/ depend
	$(MAKE) -C ./src/
#下面,构建 opencl 相关的 lib,及其依赖
opencllib: makedirs cuda-sim
	$(MAKE) -C ./libopencl/ depend
	$(MAKE) -C ./libopencl/
#下面,构建 cuobjdump_to_ptxplus,及其依赖
.PHONY: cuobjdump_to_ptxplus/cuobjdump_to_ptxplus
cuobjdump_to_ptxplus/cuobjdump_to_ptxplus: makedirs
	$(MAKE) -C ./cuobjdump_to_ptxplus/ depend
	$(MAKE) -C ./cuobjdump_to_ptxplus/
#下面,创建需要的文件夹
makedirs:
	if [ ! -d $(SIM_LIB_DIR) ]; then mkdir -p $(SIM_LIB_DIR); fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/libcuda ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libcuda; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/cuda-sim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuda-sim; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuda-sim/decuda_pred_table; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/gpgpu-sim ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpgpu-sim; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/libopencl ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libopencl; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/libopencl/bin ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/libopencl/bin; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/$(INTERSIM) ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/$(INTERSIM); fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/cuobjdump_to_ptxplus; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/gpuwattch ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpuwattch; fi;
	if [ ! -d $(SIM_OBJ_FILES_DIR)/gpuwattch/cacti ]; then mkdir -p $(SIM_OBJ_FILES_DIR)/gpuwattch/cacti; fi;
#下面,终极目标
all:
	$(MAKE) gpgpusim
#下面,构建文档
docs:
	$(MAKE) -C doc/doxygen/
#下面,清除文档
cleandocs:
	$(MAKE) clean -C doc/doxygen/
#下面,清除构建的目标和构建出来的文档
clean: makedirs
	$(MAKE) cleangpgpusim
#下面,清除构建的目标和中间文件
cleangpgpusim: cleandocs
	rm -rf $(SIM_LIB_DIR)
	rm -rf $(SIM_OBJ_FILES_DIR)

3.2

3.3

3.4

3.5

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1022265.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

GD32F303窗口看门狗在待机模式下运行

1.窗口看门狗 独立看门狗的时钟关闭不了&#xff0c;所以低功耗模式下需要定期唤醒喂狗&#xff0c;否则就会重启&#xff0c;比较麻烦。窗口看门狗使用的是APB1时钟&#xff0c;低功耗模式下时钟就停止了&#xff0c;所以不需要定期唤醒喂狗。但是窗口看门狗有喂狗的时间窗口&…

韩国市场最全开发攻略

2022年1月1日&#xff0c;RCEP正式生效施行&#xff0c;韩国也是首次跟中国缔结自贸条约&#xff0c;更低的关税&#xff0c;更灵活的贸易规则、更简洁的通关程序都将为中韩在贸易上继续发力增加了更多可施展的空间。这也将帮助更多的企业在东亚市场大展拳脚&#xff0c;推进整…

归并排序~

将一个无序系列&#xff0c;分成小系列&#xff0c;相邻两个小系列进行排序合并&#xff0c;再将两个相邻小系列排序合并&#xff0c;。。。。 int[] data {0,5,4,8,9,3,2,67,23} len 9 第一次每个元素一组 0,5,4,8,9,3,2,67,23 相邻排序合并 …

Vue框架分享与总结

总结开发中最常用的vue语法&#xff0c;以及对特定语法的理解。vue官网 文章目录 一、创建vue项目1、使用开发工具创建2、使用命令行创建3、vue框架结构4、Vue文件结构 二、Vue 常用模板语法1、v-if、v-show2、v-for3、v-on4、v-bind5、v-model 三、组件通信1、父组件给子组件传…

Bytebase 2.8.0 - ​全新升级的数据脱敏功能

&#x1f680; 新功能 全新升级的数据脱敏功能&#xff0c;提供更加细化的脱敏和访问权限配置。全新升级的 SQL 编辑器界面。库表同步功能支持 Oracle。支持设置公告。 &#x1f384; 改进 新增基于 MySQL parser 的数据脱敏内核。调整了侧边栏数据库列表&#xff0c;用最近…

Docker实战-第一章欢迎来到Docker世界

Docker基础 什么是Docker docker是包括一个命令行程序、后台守护进程和一组远程服务&#xff0c;它简化了安装、运行、发布和删除软件的工作。docker实现的基础是UNIX的容器技术。所以在docker出世之前已经有容器的概念&#xff0c;而且像谷歌一类公司也在探索自己的容器&…

关于taos数据库使用过程中突发“unable to establish connection”问题解决

项目使用的版本信息 1.taos的版本信息 3.0.4.1 2.jdbc的版本 3.2.1 3.druid连接池版本 1.2.11问题描述 Java应用服务连接&#xff0c;突然大量抛出如下的异常信息导致应用宕机&#xff1a; sql: select server_status(), desc: unable to establish connection和集团DBA沟通…

云原生微服务 第四章 Spring Cloud Netflix 之 Eureka

系列文章目录 第一章 Java线程池技术应用 第二章 CountDownLatch和Semaphone的应用 第三章 Spring Cloud 简介 第四章 Spring Cloud Netflix 之 Eureka 文章目录 系列文章目录[TOC](文章目录) 前言1、Eureka 两大组件2、Eureka 服务注册与发现3、案例3.1、创建主工程3.1.1、主…

(超详解)堆排序+(图解)

目录&#xff1a; 1:如何建堆(两种方法) 2:两种方法建堆的时间复杂度分析与计算 3:不同类型的排序方式我们应该如何建堆 文章正式开始&#xff1a; 1&#xff1a;如何建堆 在实现堆排序之前我们必须得建堆&#xff0c;才能够实现堆排序 首先在讲解如何建堆之前让我们先来回顾一…

保研复习-计算机组成原理

计算机组成原理 计算机组成冯诺依曼体系结构计算机系统的层次结构计算机的五大组成部件编译和解释的区别 CPUCPU的组成寄存器的类型指令类型指令功能指令执行过程 存储器存储器的层次结构寻址方式 输入和输出io方式有哪几种IO接口的基本结构 计算机组成 冯诺依曼体系结构 存储…

如何将你在树莓派上部署的 IoT 物联网 MQTT 服务发布到公网?

​ 上一章&#xff0c;你成功的在树莓派搭建了 EMQX 开源社区版&#xff0c;用来提供 MQTT 服务&#xff0c;并验证了设备端接入和消息通信。但你发现只能在局域网内访问 emqx.local 服务&#xff0c;而 IoT 设备分布在全国各地公共网络环境&#xff0c;这些设备该如何接入呢&a…

Android 13 CameraMetadata详解1 (内存分布以及增删改查)

文章目录 简介allocate_camera_metadataadd_camera_metadata_entrydelete_camera_metadata_entryupdate_camera_metadata_entryfind_camera_metadata_entry 点赞收藏加关注&#xff0c;下次找我不迷路。 也欢迎关注微信公众号 无限无羡 期待与你的相识&#xff01; 简介 初识…

【面试必刷TOP101】删除链表的倒数第n个节点 两个链表的第一个公共结点

目录 题目&#xff1a;删除链表的倒数第n个节点_牛客题霸_牛客网 (nowcoder.com) 题目的接口&#xff1a; 解题思路&#xff1a; 代码&#xff1a; 过啦&#xff01;&#xff01;&#xff01; 题目&#xff1a;两个链表的第一个公共结点_牛客题霸_牛客网 (nowcoder.com) …

雷达仿真:FMCW DDMA-MIMO 3D点云获取方法

1.DDMA-MIMO原理 由于TDMA-MIMO采用不同单天线交替发射信号&#xff0c;没有更好的利用发射天线同时工作的发射资源&#xff0c;导致发射功率低以及损耗大&#xff0c;从而使得TDMA波形只能应用在近距离探测的低功率雷达场景。而DDMA波形则能很好的弥补TDMA上述缺点&#xff0c…

为什么用IP访问网站也要使用SSL证书

IP地址SSL证书是一种专门用于公网IP地址验证的数字证书。它可以为公网IP地址提供安全的数据传输保障&#xff0c;解决了IP地址明文传输的安全隐患&#xff0c;保护了IP地址的数据传输安全。 与普通的SSL证书不同&#xff0c;IP地址SSL证书是基于IP地址进行验证的。在申请IP地址…

ssh登录时间久或登陆后报错

情况1 问题描述&#xff1a; ssh登录时间很久&#xff0c;登录后出现abrt-cli status timed out 的报错 问题原因&#xff1a; .lock文件被锁导致 执行systemctl status abrtd.service可以看到被锁的.lock 处理方式&#xff1a; ps -ef | grep pid 找到被锁的进程kill掉…

Java基于SpringBoot的在线考试系统的研究与实现(附源码,教程)

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝30W,Csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 文章目录 第一章第二章.主要技术第三章第四章 系统设计4.1功能结构4.2 数据库设计4.2.1 数据库E/R图4.2.2 数…

Windows安装cuda和cudnn教程最新版(2023年9月)

文章目录 cudacudnn cuda 查看电脑的cuda最高驱动版本&#xff08;适用于N卡电脑-Nvidia&#xff09; winR打开命令行&#xff0c;输入nvidia-smi 右上角cuda -version就是目前支持的最高cuda版本 nvidia官网下载cuda 下载地址&#xff1a;https://developer.nvidia.com/cuda…

pip常用指令

文章目录 简介pip的基本用法常用指令查看pip版本安装Python软件包指定版本安装Python软件包pip安装多个Python软件包通过requirements.txt文件批量安装Python软件包pip安装本地whl安装包 下载安装包到本地将已安装的Python软件包信息导出到指定文件中卸载Python软件包查看当前环…

[S2] Challenge 25 心脏病预测

问题 您是一家医疗保健公司的数据科学家&#xff0c;试图创建患者是否患有心脏病的预测因子。目前&#xff0c;您正在试验 11 种不同的特征&#xff08;潜在心脏病指标&#xff09;和 XGBoost 分类模型&#xff0c;您注意到它的性能可能会根据其调整方式而发生很大变化。在此挑…