背景
mpirun在root权限运行会报错:mpirun has detected an attempt to run as root.
解决办法
原来命令:
mpirun -np 2 --mca btl openib,self,vader --mca btl_openib_if_include mlx5_0,mlx5_1 --mca btl_openib_cpc_include rdmacm -x NCCL_SOCKET_IFNAME=enp1s0f0 ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 1 -c 0
添加参数:--allow-run-as-root
mpirun -np 2 --allow-run-as-root --mca btl openib,self,vader --mca btl_openib_if_include mlx5_0,mlx5_1 --mca btl_openib_cpc_include rdmacm -x NCCL_SOCKET_IFNAME=enp1s0f0 ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 1 -c 0
其他
还可以通过环境变量解决:
OMPI_ALLOW_RUN_AS_ROOT=1 #直接忽略
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 #需要用户选择