在Ubuntu 16.04 VirtualBox上安装Rmpi [英] Installing Rmpi on Ubuntu 16.04 VirtualBox

查看:162
本文介绍了在Ubuntu 16.04 VirtualBox上安装Rmpi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VM VirtualBox上创建了新的ubuntu-16.04.2-desktop-amd64计算机,并且希望能够将R环境与Rmpi一起使用.

I created a new ubuntu-16.04.2-desktop-amd64 machine on VM VirtualBox and I want to be able to use the R environment with Rmpi.

以下两种方法都给出类似的错误.

Both of the below approaches gives a similar error.

更新的简化的预构建二进制方法:

在安装Ubuntu后,我打开了一个终端并执行以下命令:

When Ubuntu had installed I opened a terminal and executed the following commands:

~$ sudo apt-get update
~$ sudo apt-get install openmpi-bin
~$ sudo apt-get install r-base
~$ sudo apt-get install r-cran-rmpi
~$ R

这打开了R终端,我调用了跟随函数,导致了错误:

This opened the R terminal and I invoking the follow function which resulted in an error:

> library(Rmpi)
libmpi.so: cannot open shared object file: No such file or directory
Error : .onLoad failed in loadNamespace() for 'Rmpi', details:
call: fun(libname, pkgname)
error: Cannot start MPI_Init(). Exit
Error: package or namespace load failed for ‘Rmpi’

我尝试过的替代方法包括使用本地OpenMPI安装和使用R函数install.packages安装Rmpi软件包(请参见下文).这些都导致了相同的错误.

Alternative approaches that I have attempted include using a local OpenMPI installation and using the R function install.packages to install the Rmpi package (see below). These all resulted in the same error.

我还尝试通过将~$ sudo apt-get install mpich替换为上述过程中的第二个命令来使用MPICH(包括使用R函数安装软件包),这会导致更加繁重的运行时错误.

I have also tried using MPICH by substituting ~$ sudo apt-get install mpich as the second command in the above procedure (including using the R function for installing the package) which results in an even more onerous runtime error.

有人知道我做错了什么或者我可以解决该安装错误吗?

Does anyone know what I have done wrong or what I can do to resolve this installation error?

或者,是否有人能够使用任何Linux发行版或具有预安装组件的映像成功地使用Rmpi安装VirtualBox计算机?

Or alternatively, have anyone been able to successfully install a VirtualBox machine with Rmpi using any Linux distro or an image with pre-installed components?

原始本地安装方法:

Original local installation approach:

我已按照

I have followed the instructions on this blog to download OpenMPI version 2.1.0, compile and install it. However when I try to install the package in R with:

> install.packages("Rmpi", configure.args =
  c("--with-Rmpi-include=/home/jormunr/openmpi/include",
    "--with-Rmpi-libpath=/home/jormunr/openmpi/lib",
    "--with-Rmpi-type=OPENMPI",
    "--with-mpi=/home/jormunr/openmpi/"))

出现以下错误

Error: .onLoad failed in loadNamespace() for 'Rmpi', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/jormunr/R/x86_64-pc-linux-gnu-library/3.2/Rmpi/libs/Rmpi.so':
libmpi.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed

我可以看到'libmpi.so.20'文件位于我作为安装参数之一提供的/home/jormunr/openmpi/lib中.

I can see that the 'libmpi.so.20' file is in the /home/jormunr/openmpi/lib that I provided as one of the parameter to the installation.

推荐答案

[免责声明:我不是Linux专家,只具有用户级技能.专家的任何贡献或纠正将不胜感激.]

[Disclaimer: I am not a Linux expert and merely have user level skills. Any contributions or corrections from an expert will be greatly appreciated.]

预构建二进制方法

尽管尝试了各种方法来安装预构建的二进制文件,但我没有设法使该选项起作用.这涉及在终端中执行命令"sudo apt-get install r-cran-rmpi"以安装r-cran-rmpi预先构建的软件包,该软件包还将自动安装列出的先决条件libopenmpi1.10软件包.但是,似乎文件'libmpi.so'没有包含在libopenmpi1.10包中,而是Rmpi库期望的,这会在R环境中导致找不到该文件的错误.

Although trying various ways to install the prebuilt binaries I did not manage to get this option to work. This involved executing in the terminal the command 'sudo apt-get install r-cran-rmpi' to install the r-cran-rmpi prebuilt packages which also automatically installs the libopenmpi1.10 package that is a listed prerequisite. However, it appears that the file 'libmpi.so' is not included in the libopenmpi1.10 package but expected by the Rmpi library which causes an error in the R environment that it cannot find this file.

本地安装方法

本地安装最终成功,但进行了一些修改.我使用默认设置创建了一个新的ubuntu-16.04.2-desktop-amd64 VirtualBox映像,但默认设置为2048MB内存和32GB硬盘空间.安装后,我打开了一个终端并执行了

The local installation did eventually succeed with a few amendments. I created a new ubuntu-16.04.2-desktop-amd64 VirtualBox image with default settings, except for 2048MB of memory and 32GB of hard drive space. When installed I opened a terminal and executed the commands from the Jovinge Lab website with the inclusion of the penultimate command which amends the run-time link editor's path and enables the install.package() function of R to find the 'libmpi.so' file. (also changed the version to 1.10.6 as this is the latest version release of version 1 – see below for version 2)

~$ cd /home/jormunr
~$ wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz
~$ tar -zxvf openmpi-1.10.6.tar.gz
~$ cd openmpi-1.10.2
~$ ./configure --prefix=/home/jormunr
~$ make
~$ make install
~$ sudo apt-get install r-base
~$ export LD_LIBRARY_PATH=/home/jormunr/lib:$LD_LIBRARY_PATH
~$ R

这将打开R终端,我调用了该函数:

This opens an R terminal and I invoked the function:

> install.packages("Rmpi", configure.args =
+ c("--with-Rmpi-include=/home/jormunr/include/",
+   "--with-Rmpi-libpath=/home/jormunr/lib/",
+   "--with-Rmpi-type=OPENMPI",
+   "--with-mpi=/home/jormunr/"))

现在执行此操作没有错误,我可以使用以下R语句对其进行测试:

This now executed without errors and I could test it with the following R statements:

> library("Rmpi")
> mpi.spawn.Rslaves()
master (rank 0, comm. 1) of size 2 is running on: Valhalla
slave1 (rank 1, comm. 1) of size 2 is running on: Valhalla
> mpi.close.Rslaves()
[1] 1
> mpi.quit()

当我尝试使用OpenMPI版本2.1.0进行此过程时,安装成功完成,但是上述测试存在问题; mpi.spawn.Rslaves()函数已完成,但mpi.close.Rslaves()未完成–从未返回,并且终端被挂起.

When I tried this process with the OpenMPI Version 2.1.0 the installation completed successfully but the above test had issues; the mpi.spawn.Rslaves() function completed but mpi.close.Rslaves() did not complete – it never returned and the terminal was left hanging.

这篇关于在Ubuntu 16.04 VirtualBox上安装Rmpi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆