CentOS上编译运行PKR
安装编译工具相关包
代码语言:javascript复制sudo yum groupinstall -y "Development Tools"
sudo yum install -y epel-release wget which openmpi openmpi-devel openmpi3 openmpi3-devel
安装gcc-11
代码语言:javascript复制yum install -y centos-release-scl
yum install -y devtoolset-11-gcc*
ln -s /opt/rh/devtoolset-11/root/bin/gcc /usr/bin/gcc-11
ln -s /opt/rh/devtoolset-11/root/bin/g /usr/bin/g -11
编译运行
从 https://github.com/ParRes/Kernels 下载最新版本 Kernels-default.zip。
解压后,将 common/make.defs.gcc 文件重命名为 common/make.defs。
修改 common/make.defs 文件
代码语言:javascript复制# 将
MPIDIR=/opt/homebrew/Cellar/open-mpi/4.1.1_2
MPICC=${MPIDIR}/bin/mpicc
# 修改为
MPIDIR=/usr/lib64/openmpi3
MPICC=${MPIDIR}/bin/mpicc -std=c99
设置一下 mpi 的环境变量
代码语言:javascript复制export PATH=$PATH:/usr/lib64/openmpi3/bin
编译并运行,这里只编译了部分内容,变异后的测试程序都在 scripts 目录下
代码语言:javascript复制make allserial
./scripts/small/runserial
./scripts/wide/runserial
make allopenmp
./scripts/small/runopenmp
./scripts/wide/runopenmp
make allmpi1
./scripts/small/runmpi1
./scripts/wide/runmpi1
。。。
制作容器环境
创建Dockerfile,内容如下:
代码语言:javascript复制FROM centos:centos7
MAINTAINER Fanbin Kong "kongxx@hotmail.com"
RUN yum groupinstall -y "Development Tools"
RUN yum install -y epel-release wget which openmpi openmpi-devel openmpi3 openmpi3-devel
RUN yum install -y centos-release-scl
RUN yum install -y devtoolset-11-gcc*
RUN ln -s /opt/rh/devtoolset-11/root/bin/gcc /usr/bin/gcc-11
RUN ln -s /opt/rh/devtoolset-11/root/bin/g /usr/bin/g -11
export PATH=$PATH:/usr/lib64/openmpi3/bin
制作镜像
代码语言:javascript复制sudo docker build -t prk:v1 .
运行容器
代码语言:javascript复制sudo docker run --name=test -v /home/ubuntu/test/Kernels-default:/Kernels-default -i -t prk:v1 /bin/bash
参考上面的修改,编译运行代码。