UCL-RITS / rcps-buildscripts

Scripts to automate package builds on RC Platforms
MIT License
39 stars 26 forks source link

COSI-Corr and ENVI [IN03648134] #271

Closed hillary-b closed 4 years ago

hillary-b commented 5 years ago

Would it be possible to install ENVI on Myriad? I am also using an IDL/ENVI package called COSI-Corr (http://www.tectonics.caltech.edu/slip_history/spot_coseis/download_software.html). Is it possible to install COSI-Corr on Myriad as well? I have the installation files already on my drive on Myriad, if it helps.

balston commented 5 years ago

There should be no problem installing ENVI on Myriad as the UCL site license allows this and I've had a test installation of an earlier version on Legion in the past. I wasn't sure if ENVI would be suitable to be run in a mainly batch environment but a Google search shows that ENVI can be run in a batch job. For example see:

https://www.harrisgeospatial.com/Support/Maintenance-Detail/ArtMID/13350/ArticleID/15887/Batch-Processing-using-an-ENVITask

So we will proceed with installing the latest version of ENVI - 5.5.2 and IDL 8.72.

balston commented 5 years ago

COSI-Corr is free for non-commercial research use for Academics. Not sure if the license agreement allows for central cluster installation. I'm investigating this.

balston commented 5 years ago

The ENVI installer can be run in silent mode. All you need is a file of responses to the installer:

install.sh -s < file-of-responces

I'm going to do a test install in my area on Myriad to allow me to generate an appropriate file. I will then produce a build script.

balston commented 5 years ago

Test install completed, build script produced and run:

cd /shared/ucl/apps/build_scripts/
./ENVI-5.5.2_install

It appears to have completed successfully. I now need to produce a module file (or maybe two, one for ENVI and one for IDL) and run some tests.

balston commented 5 years ago

First version of ENVI module file produced. Now running some simple tests on a qrsh session ...

balston commented 5 years ago

ENVI is hanging during startup or at least very very slowwwwww.

balston commented 5 years ago

I've done a test install on ENVI on my local Centos 7 VM using the same silent install and module file and this starts up without problems. Note: in this case I'm using the same userid for installation and running ENVI.

The following maybe why the Myriad install is not working:

https://www.harrisgeospatial.com/Support/Forums/aft/6027

balston commented 5 years ago

I don't think this is the problem as running IDL on its own using either:

module load envi/5.5.2
idl

or starting the IDL development environment using:

idlde

start quickly and appear to be working.

balston commented 5 years ago

Back to trying ENVI. I left ENVI and full IDL starting and eventually (after about 20 minutes) the ENVI GUI appeared and works!

balston commented 5 years ago

Note during startup I'm getting the OpenGL errors:

IDL 8.7.2 (linux x86_64 m64).
(c) 2019, Harris Geospatial Solutions, Inc.

% Restored file: ENVI.
% Loaded DLM: PNG.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
% Loaded DLM: HPGRAPHICS.
% Loaded DLM: IDLJSON.
% Loaded DLM: XML.

This is the point where it appears to hang.

balston commented 5 years ago

Solved the OpenGL errors by exporting:

LIBGL_ALWAYS_INDIRECT=1

before starting ENVI. Startup still very slow.

balston commented 5 years ago

Looking at how to start up ENVI headless (ie with no X so we can run jobs). The following code snippit appears to be the way to go:

  ; Catch errors during batch mode

   CATCH, err

  IF err NE 0 THEN BEGIN
     CATCH, /CANCEL
     PRINT, !ERROR_STATE.MSG
     e.Close
     RETURN
 ENDIF

 ; Start ENVI in batch mode and setup file for errors.
 e = envi (/HEADLESS)
 e.logfile = 'batch.err'

; Do stuff!

Note: to run jobs will need ENVI + IDL. ENVI_RT is not sufficient.

balston commented 5 years ago

My first ENVI batch job has worked!

balston commented 5 years ago

Here is my working job script:

#!/bin/bash -l

# Batch script to run a multi-threaded ENVI job on Myriad. 
# ENVI Version 5.5.2

# Use qsub of form:
#
# qsub -v R_input=`pwd`/test-RNetCDF.R,R_output=test-RNetCDF.out run-R-MC.sh

# 1. Force bash as the executing shell.
#$ -S /bin/bash

# 2. Request ten minutes of wallclock time (format hours:minutes:seconds).
#    Change this to suit your requirements.
#$ -l h_rt=0:10:0

# 3. Request 2 gigabyte of RAM. Change this to suit your requirements.
#$ -l mem=2G

#3a Request 15 GB TMPDIR (default is 10)
#$ -l tmpfs=15G

# 4. Set the name of the job. You can change this if you wish.
#$ -N ENVI_ndvi_job_12

# 5. Select 12 threads (the most possible on Myriad is 36). The number of threads here
#    must equal the number of worker processes in the registerDoMC call in your
#    R program.
#$ -pe smp 12

# 6. Set the working directory to somewhere in your scratch space.  This is
# a necessary step with the upgraded software stack as compute nodes cannot
# write to $HOME.
#
# NOTE: this directory must exist.
#
# Replace "<your_UCL_id>" with your UCL user ID :)
#$ -wd /home/ccaabaa/Scratch/ENVI_Examples

# Copy example files

cp /home/ccaabaa/Software/ENVI_IDL/Examples/ENVI/run_ndvi.pro .
cp /home/ccaabaa/Software/ENVI_IDL/Examples/ENVI/main_bb_ndvi.pro .
cp /home/ccaabaa/Software/ENVI_IDL/Examples/ENVI/bb_ndvi.pro .
cp /home/ccaabaa/Software/ENVI_IDL/Examples/ENVI/bb_final_one* .

# 8. Run ENVI Example

# Load the ENVI module and set the correct number of threads for IDL to use.
#
module load envi/5.5.2
export IDL_CPU_TPOOL_NTHREADS=$NSLOTS

idl run_ndvi

The run_ndvi.pro script is:

; Main program to run bb_ndvi as a batch job

.run main_bb_ndvi.pro
exit

main_bb_ndvi.pro contains:

; main_bb_ndvi.pro - Start ENVI in headless mode and call bb_ndvi procedure

 ; Catch errors during batch mode

  CATCH, err
  IF err NE 0 THEN BEGIN
     CATCH, /CANCEL
     PRINT, !ERROR_STATE.MSG
     e.Close
    exit
  ENDIF

 ; Start ENVI in batch mode and setup file for errors.

 print, 'Starting ENVI ...'
 e = envi (/HEADLESS)
 e.log_file = 'batch.err'

 ; Run bb_ndvi procedure on bb_final_one image file.
 ; result saved in ndvi_result

 in_name   = 'bb_final_one'
 out_name  = 'ndvi_result'
 bb_ndvi, in_name, out_name

end

The bb_ndvi procedure was found via a google search:

; From Prof Philip Lewis - Geography - UCL.

pro bb_ndvi, in_name, out_name

 envi_open_file, in_name, r_fid=fid
 if (fid eq -1) then begin
      free_lun, u
      envi_exit
      return
 endif
 envi_file_query, fid, ns=512, nl=512, nb=4
 dims = [-1, 0, 511, 0, 511]
 pos  = [4,3] -1
 envi_check_save, /transform

 ndvi_doit, fid=fid, pos=pos, dims=dims, out_name=out_name, r_fid=r_fid, out_dt=4

 envi_exit
 free_lun, u
end
balston commented 5 years ago

I'm going to sign up for a COSI-Corr academic license to see if we can install it centrally.

balston commented 5 years ago

Sign up from here:

http://www.tectonics.caltech.edu/slip_history/spot_coseis/download_software.html

balston commented 5 years ago

Sign up submitted. I'm now waiting for a download link.

balston commented 5 years ago

OK I have the download link and have downloaded the COSI-Corr package.

Looking at the license agreement it appears that the agreement covers to whole of UCL so there are no licensing issues about installing on Myriad.

balston commented 5 years ago

COSI_Corr install archive is now on Myriad in:

/shared/ucl/apps/COSI-Corr/installers/cosi-corr_pakOct14.zip

Now sorting out. build script for it.

balston commented 5 years ago

I now have a build script for COSI_Corr to test on Myriad.

balston commented 5 years ago

Build script uploaded to Myriad and run. Now creating module file.

balston commented 5 years ago

Module uploaded to Myriad. Simple tests work. Use the following module commands to access COSI-Corr:

module load envi/5.5.2
module load cosi-corr/oct14

Note: COSI-Corr only available for ENVI Classic so command line for interactive access is:

envi -classic
balston commented 5 years ago

Requester informed.

balston commented 5 years ago

I'm installing on Legion as well so ENVI and COSI-Corr will be available on Aristotle if needed.

balston commented 5 years ago

ENVI and COSI-Corr now installed on Legion.

balston commented 5 years ago

ENVI and COSI-Corr working on Aristotle.