Difference between revisions of "Rocky R Prime"
From NIMBioS
Line 15: | Line 15: | ||
=== R parallel script === | === R parallel script === | ||
Naive version | |||
<pre> | |||
library(foreach) | |||
library(doParallel) | |||
registerDoParallel(40) | |||
</pre> | |||
Only check numbers ending in 1, 3, 7 and 9 | |||
<pre> | <pre> | ||
library(foreach) | library(foreach) |
Revision as of 19:56, 6 April 2023
Insert example here
Prime Number example code
R serial script
library(foreach) registerDoSeq() library(doParallel) registerDoParallel(40)
R parallel script
Naive version
library(foreach) library(doParallel) registerDoParallel(40)
Only check numbers ending in 1, 3, 7 and 9
library(foreach) library(doParallel) registerDoParallel(40)
Slurm submission script
#!/bin/bash #SBATCH --job-name=R_PRIME ### Job Name #SBATCH --output=R_prime_%j.out ### File in which to store job output #SBATCH --time=00:10:00 ### Wall clock time limit in Days-HH:MM:SS #SBATCH --nodes=1 ### Node count required for the job #SBATCH --ntasks-per-node=1 ### Number of tasks to be launched per Node #SBATCH --mem-per-cpu=2G #SBATCH --cpus-per-task=40 module load R/4.2.1-foss-2022a date R --version time Rscript R_prime_serial.R date time Rscript R_prime_parallel.R date time Rscript R_prime_parallel_fast.R date