Install R & packages on CHTC(The Center for High Throughput Computing)

Install R & packages on CHTC:
(详见 http://chtc.cs.wisc.edu/r-jobs.shtml#version )

prepare

  1. downloads R-3.x.x.tar.gz on laptop (https://cran.r-project.org)
  2. upload R-3.x.x.tar.gz on CHTC
  3. create Create a Portable R Installation in an Interactive Job (http://chtc.cs.wisc.edu/inter-submit.shtml)

a file called interactive.sub 具体内容:

universe = vanilla
# Name the log file:
log = interactive.log

# Name the files where standard output and error should be saved:
output = process.out
error = process.err

# If you wish to compile code, you'll need the below lines. 
#  Otherwise, LEAVE THEM OUT if you just want to interactively test!
+IsBuildJob = true
requirements = (OpSysMajorVer =?= 6) && ( IsBuildSlot == true )
# If you need CentOS 7 (our new operating system), use the following 
# requirements instead of the above line: 
# requirements = (OpSysMajorVer =?= 7) && ( IsBuildSlot == true )

# Indicate all files that need to go into the interactive job session,
#  including any tar files that you prepared:
# transfer_input_files = combined.tar.gz, other_file.txt
transfer_input_files = R-3.x.x.tar.gz

# It's still important to request enough computing resources. The below 
#  values are a good starting point, but consider your file sizes for an
#  estimate of "disk" and use any other information you might have
#  for "memory" and/or "cpus".
request_cpus = 1
request_memory = 1GB
request_disk =1GB

queue
  1. submit interactive job: condor_submit -i interactive.sub (接下来在该job情况下直接运行代码)

install R

  1. tar -xzf R-3.x.x.tar.gz
  2. cd R-3.x.x
  3. ./configure --prefix=$(pwd)
  4. make
  5. make install
  6. cd …

install packages

  1. R-3.x.x/lib64/R/bin/R
  2. install.packages(‘package_name’)

edit the R executable

  1. nano R-3.x.x/lib64/R/bin/R
  2. 在里面第一行修改路径: 把R_HOME_DIR=/var/lib/condor/execute/slot1/dir_554715/R-3.1.0/lib64/R
    改成R_HOME_DIR=$(pwd)/R

exit the Interactive Job

  1. mv R-3.x.x/lib64/R ./
  2. tar -czvf R.tar.gz R/
  3. exit

结束后会有R.tar.gz这个包,之后写sh文件时放进去,就能用里面的包了:

#!/bin/bash

# untar your R installation
tar -xzf R.tar.gz

# make sure the script will use your R installation
export PATH=$(pwd)/R/bin:$PATH
export RHOME=$(pwd)/R

# run R, with the name of your  R script
Rscript myscript.R
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值