0

Rコードを実行するだけで動作します。ただし、ジョブを送信すると機能しません。

myRcode.Rジョブを送信してファイルを実行しようとしています。.shファイルは次のとおりです。

#!/bin/bash
#PBS -N myRexample # Set job name to myjob
#PBS -l nodes=1:ppn=2 # Request 1 node with 2 processors
#PBS -l mem=8gb # Request 8gb memory
#PBS -l walltime=1:00:00 # Request 1hr job time
#PBS -V # Use submission environment
cd "$PBS_O_WORKDIR"
Rscript myRcode.R 

以下は私のRコードです(myRcode.R):

#!/usr/bin/env Rscript
#Call the required functions and library
source("function1.R") 
library(R2jags)

#Function to be used in parallel computation  
mysim <- function(sim_number){
  set.seed(sim_number)
  outs <- function1() #rjags is called inside function1.
    return(list(outs[[1]],outs[[2]]))
}
 
#Parallel Computation
library(parallel)
library(doParallel)
registerDoParallel(cl <- parallel::makeCluster(2,outfile="test.txt"));

    results <- foreach(x = 1:2,
                        .packages = c('MASS','R2jags'))%dopar% { mysim(sim_number=x)} 
  stopCluster(cl)

以下は私が得ているエラーです:

Loading required package: rjags
Loading required package: coda
Linked to JAGS 4.0.0
Loaded modules: basemod,bugs

Attaching package: ‘R2jags’

The following object is masked from ‘package:coda’:

    traceplot

Loading required package: foreach
Loading required package: iterators
Error in unserialize(socklist[[n]]) : error reading from connection
Calls: %dopar% ... recvOneData -> recvOneData.SOCKcluster -> unserialize
Execution halted

test.txtファイルは次のとおりです。

starting worker pid=59438 on localhost:11788 at 08:55:04.422
starting worker pid=59451 on localhost:11788 at 08:55:04.799
Loading required package: rjags
Loading required package: rjags
Loading required package: coda
Loading required package: coda
Linked to JAGS 4.0.0
Loaded modules: basemod,bugs
Linked to JAGS 4.0.0
Loaded modules: basemod,bugs

Attaching package: ‘R2jags’


Attaching package: ‘R2jags’

The following object is masked from ‘package:coda’:

    traceplot

The following object is masked from ‘package:coda’:

    traceplot


 *** caught illegal operation ***
address 0x7f51ceed1917, cause 'illegal operand'

 *** caught illegal operation ***
address 0x7fe45c73d917, cause 'illegal operand'
4

0 に答える 0