VSe*_*urt 5 profiling cuda gpu nvidia mpi
我快速浏览了论坛,但我认为尚未有人问过这个问题。
我目前正在使用别人在博士期间编写的MPI / CUDA混合代码。每个CPU都有自己的GPU。我的任务是通过运行(已经工作的)代码来收集数据,并实现其他功能。目前暂时无法将此代码转换为一个CPU / Multi-GPU。
我想利用性能分析工具来分析整个过程。
现在的想法是让每个CPU为其自己的GPU启动nvvp并收集数据,而另一个性能分析工具将处理常规的CPU / MPI部分(我打算像往常一样使用TAU)。
问题是,同时启动nvvp的界面8次(如果与8个CPU / GPU一起运行)非常烦人。我想避免通过该界面,而是获得一个直接将数据写入文件的命令行,以便以后可以将其提供给nvvc的界面并进行分析。
我想获得一个命令行,该命令行将由每个CPU执行,并将为每个CPU生成一个文件,以提供有关其自身GPU的数据。8(GPU / CPU)= 8个文件。然后,我计划分别使用nvcc逐个添加和分析这些文件,并手动比较数据。
任何的想法 ?
谢谢 !
看看nvprof,在部分CUDA 5.0工具包(目前作为一个候选发布版)。有一些限制-在给定的传递中它只能收集有限数量的计数器,并且不能收集指标(因此,如果您想要多个事件,那么现在您必须编写多个启动脚本)。您可以从nvvp内置帮助中获得更多信息,包括示例MPI启动脚本(在此处复制,但是如果您有比5.0 RC更高的版本,我建议您查看nvvp帮助以获取最新版本)。
#!/bin/sh
#
# Script to launch nvprof on an MPI process. This script will
# create unique output file names based on the rank of the
# process. Examples:
# mpirun -np 4 nvprof-script a.out
# mpirun -np 4 nvprof-script -o outfile a.out
# mpirun -np 4 nvprof-script test/a.out -g -j
# In the case you want to pass a -o or -h flag to the a.out, you
# can do this.
# mpirun -np 4 nvprof-script -c a.out -h -o
# You can also pass in arguments to nvprof
# mpirun -np 4 nvprof-script --print-api-trace a.out
#
usage () {
echo "nvprof-script [nvprof options] [-h] [-o outfile] a.out [a.out options]";
echo "or"
echo "nvprof-script [nvprof options] [-h] [-o outfile] -c a.out [a.out options]";
}
nvprof_args=""
while [ $# -gt 0 ];
do
case "$1" in
(-o) shift; outfile="$1";;
(-c) shift; break;;
(-h) usage; exit 1;;
(*) nvprof_args="$nvprof_args $1";;
esac
shift
done
# If user did not provide output filename then create one
if [ -z $outfile ] ; then
outfile=`basename $1`.nvprof-out
fi
# Find the rank of the process from the MPI rank environment variable
# to ensure unique output filenames. The script handles Open MPI
# and MVAPICH. If your implementation is different, you will need to
# make a change here.
# Open MPI
if [ ! -z ${OMPI_COMM_WORLD_RANK} ] ; then
rank=${OMPI_COMM_WORLD_RANK}
fi
# MVAPICH
if [ ! -z ${MV2_COMM_WORLD_RANK} ] ; then
rank=${MV2_COMM_WORLD_RANK}
fi
# Set the nvprof command and arguments.
NVPROF="nvprof --output-profile $outfile.$rank $nvprof_args"
exec $NVPROF $*
# If you want to limit which ranks get profiled, do something like
# this. You have to use the -c switch to get the right behavior.
# mpirun -np 2 nvprof-script --print-api-trace -c a.out -q
# if [ $rank -le 0 ]; then
# exec $NVPROF $*
# else
# exec $*
# fi
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2712 次 |
| 最近记录: |