Giter Site home page Giter Site logo

Comments (6)

jeffreyhanson avatar jeffreyhanson commented on June 14, 2024

Thanks for reaching out @andresrj!

I'm sorry, I've never used SLURM before. Based on reading this web site (https://help.rc.ufl.edu/doc/Sample_SLURM_Scripts), it seems that you need to write a plain text file (possibly BASH script?) with (1) some comments containing job requirements (e.g. CPU usage and RAM usage) and (2) some system commands that tell it how to run the code. I would suggest writing an R script that contains the R code for running prioritizr and then calling it in in the SLURM job file. I'm guessing something like this might work as a starting point?

SLURM file (note that you might need to change some things, e.g., modules, email address, file paths)

#!/bin/bash
#SBATCH --job-name=prioritizr-run      # Job name
#SBATCH --mail-type=END,FAIL         # Mail events (NONE, BEGIN, END, FAIL, ALL)
#SBATCH [email protected]    # Where to send mail	
#SBATCH --nodes=1                    # Run all processes on a single node	
#SBATCH --ntasks=1                   # Run a single task		
#SBATCH --cpus-per-task=4            # Number of CPU cores per task
#SBATCH --mem=5gb                    # Job memory request
#SBATCH --time=00:05:00              # Time limit hrs:min:sec
#SBATCH --output=prioritizr-run-%j.log     # Standard output and error log
pwd; hostname; date

module load R

R CMD BATCH --no-restore --no-save prioritizr-code.R

/data/training/SLURM/prime/prime

date

R script (saved in file prioritizr-code.R):

# load packages
library(prioritizr)

# load data
data(sim_pu_raster, sim_features)

# create problem
p <- problem(sim_pu_raster, sim_features) %>%
     add_min_set_objective() %>%
     add_relative_targets(0.1) %>%
     add_binary_decisions() %>%
     add_cbc_solver(gap = 0, verbose = FALSE)

# generate solution
s <- solve(p)

# save solution
saveRDS(s, "results.rds")

Does that help?

from prioritizr.

jeffreyhanson avatar jeffreyhanson commented on June 14, 2024

@andresrj, I just wanted to follow up and ask if you were able to get prioritizr running on the cluster?

from prioritizr.

andresrj avatar andresrj commented on June 14, 2024

Yes, thank you very much. I contacted gurobi and obtained an academic licence for the cluster in our university (it seemed that was the problem because we use gurobi as prioritizr solver). I even had the chance to play a little with singularity and that way avoid other library errors I was getting from my R script launched with SLURM... It was really a lot to learn but a nice experience after all (and I still have a lot to learn from prioritizr website. Thanks!)

from prioritizr.

jeffreyhanson avatar jeffreyhanson commented on June 14, 2024

Awesome! It sounds like everything's working now - is that right? If so, would you mind if I closed the issue? Happy to answer any more questions if that's helpful?

from prioritizr.

andresrj avatar andresrj commented on June 14, 2024

Yes, I have it working and now to learn how to use it properly. Thank you very much, you have been very helpful! :D

from prioritizr.

jeffreyhanson avatar jeffreyhanson commented on June 14, 2024

No worries - happy to help!

from prioritizr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.