r - Pmetrics : declare default fortran compiler before calling PMBuild()

标签 r linux docker gfortran

我们正在尝试使用名为 Pmetrics 的 R 包

这通常不支持 Linux 环境,但我们想在并行设置中执行一些测试。例如。分布在 20 个容器中的 1000 次分布式测试。

使用此 Dockerfile,您可以重现错误。

FROM centos:centos7.5.1804
RUN yum -y install gcc-gfortran epel-release
RUN mkdir /root/pksim
RUN mkdir /root/pksim/Rlibraries
WORKDIR /root/pksim
RUN yum -y install R
COPY test.r test.r
COPY install.r install.r

install.r 脚本包含这些行

.libPaths("/root/pksim/Rlibraries")
install.packages("http://www.lapk.org/software/Pmetrics/Repos/src/contrib/Pmetrics_1.5.2.tar.gz", repos=NULL)

test.r 脚本包含这些行

r = getOption("repos")
r["CRAN"] = "http://lib.ugent.be/CRAN/"
options(repos = r)
rm(r)
.libPaths("/root/pksim/Rlibraries")
library(Pmetrics)
PMbuild()

您可以使用这些命令使其工作:

  • 构建镜像:docker build -t pksim .
  • 运行图像:docker run -ti pksim/bin//bash。应该会出现一个控制台。
  • 运行 R install.r 脚本(在控制台上):Rscript install.r
  • 运行 R test.r 脚本(在控制台上):Rscript test.r 它在调用 PMBuild() 时卡住

当执行 test.r 时,进程陷入无限循环,请求用户输入。

Pmetrics needs to know which Fortran compiler you are using.
You only have to specify this once.
However, you can reconfigure if your compiler changes
by using the command PMFortranConfig(reconfig=T).

In each of the following <exec> is a place holder for the executable file name
and <files> is a placeholder for the files to be compiled.  Both are required.
When applicable serial and parallel compile statements in Pmetrics are listed in that order.

1. gfortran -m64 -w -O3 -o <exec> <files>
    gfortran -O3 -w -fopenmp -fmax-stack-var-size=32768 -o <exec> <files>
2. g95: g95 -o -fstatic <exec> <files>
3. Intel Visual: ifort -o <exec> <files>
4. Lahey: lf90  <files> -fix -out <exec>
5. Other (define custom command)
6. Help, I don't have a Fortran compiler!

Enter the number of your compiler:

Enter the number of your compiler:

Enter the number of your compiler:

Enter the number of your compiler:

Enter the number of your compiler:

Enter the number of your compiler:

有没有办法通过在运行 PMBuild() 之前在某处设置一些选项来配置默认编译器?

我们创建了一个 GitHub包含此问题来源的 repo。

谁能想到解决方法?

最佳答案

可以创建文件 ~/.config/Pmetrics/FortConfig.txt,内容如下:

gfortran -m64 -w -O3 -o <exec> <files>
gfortran -O3 -w -fopenmp -fmax-stack-var-size=32768 -o <exec> <files>

如果您想使用 1 个建议的编译器。

关于r - Pmetrics : declare default fortran compiler before calling PMBuild(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53846902/

相关文章:

R Shiny 的 slider 输入,范围受限

r - 在 Shiny 应用程序中同步两个 rHandsontable 输出之间的列顺序

docker - Dockerfile:相对于本地主目录复制文件

docker - 如何启用 RabbitMQ Docker 容器的集群

docker - 为 Docker 容器设置 CPU 的绝对限制

r - 保持两个时间序列的共同观察

regex - 为什么不能在断言后面的零宽度中使用重复量词?

linux - 在 Linux 中的 awk 命令中使用 tr 命令

linux - 旧版 Linux 内核不可抢占的原因是什么?

linux - 在运行脚本之前检查命令是否返回错误