### View README.helloworld file using cat Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Displays the content of the 'README.helloworld' file. The file contains examples for MPI, OpenMP, and hybrid programming models. Useful for beginners to explore different parallel programming approaches on the Campus Cluster. ```bash cat /sw/cc.users/examples/README.helloworld ``` -------------------------------- ### Example of a Linux/CLI Prompt on Campus Cluster Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started This represents the typical command prompt users will see after successfully logging into a head node of the Campus Cluster via SSH. It indicates the user's NetID, the current hostname, and the working directory. ```bash [My_NetID@cc-login1 ~]$ ``` -------------------------------- ### Unix/Linux Basic Commands Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started A list of fundamental Unix/Linux commands for navigation and system information. Includes commands for listing directory contents, managing processes, and viewing help pages. ```shell ls pwd man command_name quota ps -u exit history date ``` -------------------------------- ### SCP Command for File Transfer (CLI) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Examples of using the scp command-line utility to transfer files between a local system and a remote server (Campus Cluster). Supports both uploading and downloading files. ```shell my_desktop% scp local_file My_NetID@cli-dtn.researchdata.illinois.edu:~/ my_desktop% scp My_NetID@cli-dtn.researchdata.illinois.edu:~/remote_file ./ ``` -------------------------------- ### SFTP Command for File Transfer (CLI) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Demonstrates the interactive use of the sftp command-line client for transferring files between a local system and the Campus Cluster. Includes connecting, uploading, and downloading. ```shell my_desktop% sftp My_NetID@cli-dtn.researchdata.illinois.edu sftp> put local_file sftp> get remote_file ``` -------------------------------- ### Compile and Run C Program with GCC Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Shows the commands to compile a C source file (e.g., `myprogram.c` or `hello.c`) into an executable using the GNU C Compiler (GCC) and then execute the resulting binary. It also includes a command to verify the existence of the default `a.out` executable. ```bash gcc myprogram.c ``` ```bash ./a.out ``` ```bash [My_NetID@cc-login1 ~]$ gcc hello.c ``` ```bash [My_NetID@cc-login1 ~]$ ls -l a.out ``` -------------------------------- ### Create 'Hello World' C Program using nano Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Illustrates how to create a simple 'Hello World' C program by first opening the nano text editor and then typing the C source code. The program includes a standard printf statement and an optional sleep function. The command-line prompt is included for context. ```bash [My_NetID@cc-login1 ~]$ nano hello.c ``` ```c #include main() { printf("Hello, C World!n"); /* The sleep() function causes the program */ /* to wait 90 seconds before ending. */ /* This line is optional. */ sleep(90); } ``` -------------------------------- ### Open Text File for Editing (nano/vi/vim) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Demonstrates the basic command-line syntax to open a plain text file for editing using either the nano or vi/vim text editors on a Linux system. This is a fundamental step for creating or modifying files on the command line. ```bash nano file.txt ``` ```bash vi file.txt ``` -------------------------------- ### Create and Set Permissions for Modulefiles Directory Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor This snippet demonstrates how to create a common directory for modulefiles and set group write permissions, allowing multiple users to manage modulefiles. This is a one-time setup step. ```bash mkdir -p /projects/illinois/$college/$department/$pi_netid/modulefiles chmod g+rw /projects/illinois/$college/$department/$pi_netid/modulefiles ``` -------------------------------- ### Submit a job to the batch system using sbatch Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Submits a job script to the batch system for execution. 'myjob.sbatch' is the name of the script containing the job's instructions. This command schedules the job for execution on the cluster's compute nodes. ```bash sbatch myjob.sbatch ``` -------------------------------- ### Run executable in Linux Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Executes a compiled program named 'a.out' in the current directory. This command is typically used after compiling a C or C++ program. ```bash ./a.out ``` -------------------------------- ### Create and Edit Slurm Batch Job Script using nano Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Demonstrates how to create a Slurm batch job script using the nano text editor, including the command to open the editor for a new file and the full script content. The script defines essential Slurm directives such as time, nodes, tasks per node, job name, account, partition, and output/error file paths. ```bash [My_NetID@cc-logn1 ~]$ nano myjob.sbatch ``` ```bash #!/bin/bash # #SBATCH --time=00:05:00 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=16 #SBATCH --job-name=myjob #SBATCH --account=account_name # <- replace "account_name" with an account available to you #SBATCH --partition=secondary #SBATCH --output=myjob.o%j ##SBATCH --error=myjob.e%j ##SBATCH --mail-user=NetID@illinois.edu # <- replace "NetID" with your University NetID ##SBATCH --mail-type=BEGIN,END # # End of embedded SBATCH options # ``` -------------------------------- ### Display job status in the batch system with squeue Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Shows the status of all jobs owned by a specific user. Replace 'My_NetID' with the actual user's NetID. This helps monitor the progress and status of submitted jobs. ```bash squeue -u My_NetID ``` -------------------------------- ### Display details of a specific job with scontrol Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Displays detailed information about a specific job. Replace 'JobID' with the actual job identification number. Useful for debugging and understanding job resource usage. ```bash scontrol show job JobID ``` -------------------------------- ### Set Common Directory Permissions for Software Installation (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Sets read and write permissions for group members on a common software installation directory. This is a one-time setup to allow collaborative software management. ```bash chmod g+rw /projects/illinois/$college/$department/$pi_netid/apps ``` -------------------------------- ### Unix/Linux File Manipulation Commands Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started Common Unix/Linux commands for creating, editing, copying, moving, and deleting files and directories. These commands are essential for managing file systems. ```shell nano myfile grep string myfile cat myfile more myfile cp myfile1 myfile2 mv myfile1 myfile2 mv myfile mydir rm myfile mkdir mydir cd mydir rmdir mydir ``` -------------------------------- ### Create and Manage Anaconda Environments Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This set of commands illustrates how to create, activate, install packages in, and deactivate Anaconda environments. It covers creating a minimal Python environment, installing additional packages like PyTorch, listing installed packages, and creating a full clone of the base Anaconda environment. Note that environments are created in a temporary scratch directory. ```shell mkdir -p /scratch/$USER/my.conda.dir cd ${HOME} ln -s /scratch/${USER}/my.conda.dir .conda module load anaconda3 conda create -n my.anaconda python conda info -e source activate my.anaconda conda info -e conda install pytorch conda list ``` ```shell conda deactivate ``` ```shell conda create -n my.anaconda anaconda ``` -------------------------------- ### NFS Mount Parameters Example Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Example of recommended NFS mount parameters for accessing research storage. These parameters ensure efficient and reliable mounting of the filesystem. ```bash [rw/ro],soft,timeo=200,vers=4,rsize=16384,wsize=16384 ``` -------------------------------- ### Load Software Module Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor This command loads a specific software module into the current user environment. Ensure the modulefile exists in the specified path. ```bash module load /projects/illinois/$college/$department/$pi_netid/modulefiles/ ``` -------------------------------- ### Modulefile Template for Software Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor This is a template for creating a modulefile. It defines environment variables and paths required to load a specific software package, including its binary, library, and man page locations. ```tcl #%Module1.0#################################################################### ## ## proc ModulesHelp { } { global _module_name puts stderr "The $_module_name modulefile defines the default system paths" puts stderr "and environment variables needed to use the $_module_name" puts stderr "libraries and tools." puts stderr "" } module-whatis "Brief description of the software/library." set approot /installation/location/of/software/on/campuscluster prepend-path PATH $approot/bin prepend-path LD_LIBRARY_PATH $approot/lib prepend-path MANPATH $approot/share/man ``` -------------------------------- ### Display Module Help Information (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Displays basic help information for a specific module, such as version and usage details. This command is part of the environment module system for managing software. ```bash module help mvapich2/2.3.7-gcc-13.3.0 ``` -------------------------------- ### Start Interactive MATLAB Session (Command Line) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Launches an interactive batch job for command-line use of MATLAB. This command starts a bash shell on a compute node, loads the MATLAB module, and then starts MATLAB without a display. It's suitable for non-GUI MATLAB tasks. ```bash srun -A account_name --export=All --time=00:30:00 --nodes=1 --cpus-per-task=16 --partition=secondary --pty /bin/bash module load matlab matlab -nodisplay ``` -------------------------------- ### Install R Package using Rscript (Bash) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command executes an R command directly from the shell using Rscript. It installs the 'RCurl' package from the specified repository into the user's R library directory. This is useful for scripting R installations. ```bash Rscript -e "install.packages('RCurl', '~/Rlibs', 'https://cran.r-project.org')" ``` -------------------------------- ### Load Software Module by Name Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor After making modulefiles available with 'module use', this command loads a specific software module by its name. ```bash module load ``` -------------------------------- ### Start Interactive MATLAB Session with GUI Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Initiates an interactive batch job with X11 forwarding enabled, allowing GUI applications to display on the local machine. Requires an X-Server running locally and X11 forwarding enabled in the SSH client. The `-A` flag specifies the account name, `--x11` enables GUI forwarding, and `--export=All` ensures all environment variables are exported. ```bash srun -A account_name --x11 --export=All --time=00:30:00 --nodes=1 --cpus-per-task=16 --partition=secondary --pty /bin/bash module load matlab matlab ``` -------------------------------- ### Install Python Packages to User Location with pip3 Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This snippet demonstrates how to install Python packages into a user-specific directory using `pip3` with the `-t` option. It also includes steps to create the target directory, load the Python module, and configure the `PYTHONPATH` environment variable for the current session or persistently in `.bashrc`. ```shell module load python/3 mkdir -p ${HOME}/scratch/mypython3 pip3 install -t ${HOME}/scratch/mypython3 phonopy export PYTHONPATH=${HOME}/scratch/mypython3:${PYTHONPATH} ``` ```shell module load python/3 export PYTHONPATH=${HOME}/scratch/mypython3:${PYTHONPATH} ``` -------------------------------- ### Make Group Modulefiles Available Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor This command adds a directory containing group-specific modulefiles to the module system's search path, making them available for loading. ```bash module use /projects/illinois/$college/$department/$pi_netid/modulefiles/ ``` -------------------------------- ### Windows Samba Share Path Example Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Example of the path format for accessing research storage via Samba on Windows machines. Users need to replace placeholder information with their specific project details. ```bash "\\smb.researchdata.illinois.edu\$your_project_name" ``` -------------------------------- ### View Installed R Packages Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Shows the command to list all installed R packages, both user-installed and system-installed. The output is divided into libraries, and the Rscript command is used to execute the library() function. ```bash [cc-login1 ~]$ Rscript -e "library()" Packages in library '/home/jdoe/Rlibs': R6 Classes with reference semantics RCurl General network (HTTP/FTP/...) client interface for R ... stringr Simple, Consistent Wrappers for Common String Operations whisker {{mustache}} for R, logicless templating Packages in library '/usr/local/R/4.2.2/lib64/R/library': KernSmooth Functions for kernel smoothing for Wand & Jones (1995) MASS Support Functions and Datasets for Venables and Ripley's MASS ... tools Tools for Package Development utils The R Utils Package ``` -------------------------------- ### Access Campus Cluster Head Nodes via SSH Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/getting_started This command allows users to connect to the Campus Cluster's head nodes using SSH. It requires a valid NetID and password for authentication. This is the primary method for accessing cluster resources for tasks like editing files and submitting jobs. ```bash ssh My_NetID@cc-login.campuscluster.illinois.edu ``` -------------------------------- ### Initiating Interactive SLURM Jobs with srun Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Provides an example of how to launch an interactive SLURM job using the `srun` command. This includes specifying account, partition, time limit, nodes, tasks per node, and initiating a bash shell for interactive use. ```bash srun -A account_name --partition=ncsa --time=00:30:00 --nodes=1 --ntasks-per-node=16 --pty /bin/bash ``` -------------------------------- ### Install R Package (Dependency Error) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Illustrates how to install an R package from a local file (e.g., a tar.gz archive) when its dependencies are not met. This command is used when the package is not available in the CRAN repository, specifying the local file path, library path, and setting repos to NULL. It highlights the error message generated if a dependency like 'ape' is missing. ```bash [cc-login1 ~]$ Rscript -e "install.packages('phybase_1.1.tar.gz', '~/Rlibs', repos = NULL)" ERROR: dependency 'ape' is not available for package 'phybase' * removing '/home/jdoe/Rlibs/phybase' Warning message: In install.packages("phybase_1.1.tar.gz", repos = NULL) : installation of package 'phybase_1.1.tar.gz' had non-zero exit status ``` -------------------------------- ### Install R Package from Repository to Specific Location Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command installs an R package from a specified CRAN repository into a designated library path. It requires the package name, the target directory, and the repository URL. This is useful for managing user-specific package installations. ```R install.packages('package_name', '/path/to/r_libraries', 'Repository URL') ``` -------------------------------- ### Set Recursive Group Permissions for Installed Software (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Recursively sets read and execute permissions for group members on a newly installed software's directory and files. This ensures intended group users can access the software. ```bash chmod -R g+rX /projects/illinois/$college/$department/$pi_netid/apps/ ``` -------------------------------- ### List available R modules on Campus Cluster Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command displays all available R module files on the Campus Cluster, allowing users to see the different installed versions of R for statistical computing. ```bash module avail R ``` -------------------------------- ### Install Local R Package File to Specific Location Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command installs an R package from a local tarball file into a specified library path, without using a remote repository. It requires the local filename and the target directory. This is useful for installing packages that have been downloaded manually. ```R install.packages('package_name.tar.gz', '/path/to/r_libraries', repos = NULL) ``` -------------------------------- ### Install R Package (Unavailable) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Demonstrates the command to install an R package, showing a typical warning message when the package is not available in the current CRAN repository or is misspelled. This command requires Rscript and specifies the package name, library path, and CRAN repository. ```bash [cc-login1 ~]$ Rscript -e "install.packages('phybase','~/Rlibs', 'https://cran.r-project.org')" Warning message: package 'phybase' is not available (for R version 3.2.2) ``` -------------------------------- ### MacOS Samba Server Address Example Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Example of the server address format for mounting research storage via Samba on MacOS machines. This address is used in conjunction with campus AD credentials. ```bash smb://smb.researchdata.illinois.edu ``` -------------------------------- ### Check Apptainer version on Campus Cluster Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command allows users to verify the installed version of Apptainer, a container platform, on the Campus Cluster. ```bash apptainer --version ``` -------------------------------- ### Change Group Ownership for Software Installation (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Recursively changes the group ownership of all directories and files within a software installation to a specified group. This is used to ensure correct access permissions if a user belongs to multiple groups. ```bash chown -R :group_name /projects/illinois/$college/$department/$pi_netid/apps/ ``` -------------------------------- ### MATLAB: Concurrent Parallel Job Start Failure Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This error indicates a failure to start a parallel pool, often occurring when multiple parallel MATLAB jobs attempt to start simultaneously. The underlying cause can be related to a limit of one task per communicating job. ```matlab >>Starting parallel pool (parpool) using the 'local' profile ... Error using parpool (line 103) Failed to start a parallel pool. (For information in addition to the causing error, validate the profiles 'local' in the Cluster Profile Manager.) Caused by: Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line 667) Failed to start pool. Error using parallel.Job/createTask (line 277) Only one task may be created on a communicating Job. ``` ```matlab >> Starting parallel pool (parpool) using the 'local' profile ... Error using parpool (line 103) Failed to start a parallel pool. (For information in addition to the causing error, validate the profile 'local' in the Cluster Program Manager.) Caused by: Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line 667) Failed to start pool. Error using parallel.Cluster/createCommunicatingJob (line 92) The storage metadata file is corrupt. Please delete all files in the JobStorageLocation and try again. ``` -------------------------------- ### Manage environment with module commands Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software The `module` command is a user interface to the Modules package, enabling dynamic modification of the user's shell environment. These commands allow users to list available modules, load specific software, get help, and swap between different versions or applications. ```bash module avail ``` ```bash module list ``` ```bash module help modulefile ``` ```bash module display modulefile ``` ```bash module load modulefile ``` ```bash module unload modulefile ``` ```bash module swap modulefile1 modulefile2 ``` -------------------------------- ### Display Module Details (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Shows detailed information about a specific module, including environment variables it sets and paths it modifies. Useful for understanding how a module affects the user environment. ```bash module display mvapich2/2.3.7-gcc-13.3.0 ``` -------------------------------- ### Submit Parallel MATLAB Jobs with Dependencies Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Demonstrates how to submit parallel MATLAB jobs using `sbatch`, including options to stagger their start times using job dependencies. This prevents race conditions when multiple parallel jobs write to the same temporary location. `JobID` should be replaced with the actual job ID. ```bash sbatch parallel.ML-job.sbatch sbatch --dependency=after:JobID.01 parallel.ML-job.sbatch sbatch --dependency=after:JobID.02 parallel.ML-job.sbatch ... sbatch --dependency=after:JobID.NN parallel.ML-job.sbatch ``` -------------------------------- ### Create Tar Archive Command Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data This command creates a compressed tar archive of specified files or directories. The example shows bundling image files into an archive. ```bash tar -czvf images_bundle.tar.gz images ``` -------------------------------- ### View Modulefile Content (Linux) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/investor Displays the contents of a modulefile, which contains the Tcl script that defines how the module modifies the user's environment (e.g., PATH, LD_LIBRARY_PATH). ```bash cat /sw/user/modulefiles/mvapich2/2.3.7-gcc-13.3.0 ``` -------------------------------- ### MATLAB: Unavailable MATLAB Licenses Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This error occurs when attempting to start a parallel pool ('matlabpool' or 'parpool') but all licenses for the Parallel Computing Toolbox are in use. The error message provides diagnostic information and suggests checking license status or contacting the License Administrator. ```matlab >> Starting [matlabpool]/[parallel pool (parpool)] using the 'local' profiles ... License checkout failed. License Manager Error -4 Maximum number of users for Dsistrib_Computing_Toolbox reached. Try again later. To see a list of current users use the lmstat utility or contact your License Administrator. Troubleshoot this issue by visiting: http://www.mathworks.com/support/lme/R####x/4 Diagnostic Information: Feature: Distrib_Computing_Toolbox License path: /home//.matlab/R####x_licenses:/usr/local/MATLAB/R####x/licenses/license.dat:/usr/local/MATLAB/R####x/licenses/network.lic Licensing error: -4,132. Error using gcp (line 45) Unable to checkout a license for the Parallel Computing Toolbox. ``` -------------------------------- ### Enable GPU Acceleration in Apptainer Container Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/containers This command demonstrates how to launch an Apptainer container with NVIDIA GPU support enabled. The `--nv` flag is crucial for passing GPU devices into the container. Ensure GPUs are requested in Slurm submission options for this to be effective. This is primarily relevant for Linux environments and assumes NVIDIA drivers are installed on the host system. ```bash apptainer run --nv ``` -------------------------------- ### Set R Library Path Environment Variable (Bash) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command sets the R_LIBS environment variable to include the user-defined R package directory. This allows R to find and load packages installed in the custom location. It prepends the user's library path to any existing R_LIBS paths. ```bash export R_LIBS=~/Rlibs:${R_LIBS} ``` -------------------------------- ### View Account CPU Hours Used Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/acct_admin Queries the NCSA accounting system to display CPU hours utilized by a specific account. Users can adjust the start date for the report. This command does not report GPU hours. ```bash sreport -M icc -thour cluster AccountUtilizationByUser account=account_name Start="2022-01-01" ``` -------------------------------- ### MATLAB: Starting parpool with Specific Nodes and Workers Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This error arises when initiating a 'parpool' with a specified number of workers across nodes, but the cluster's 'NumWorkers' limit is lower than requested. Adjusting the 'NumWorkers' property for the local cluster is necessary. ```matlab parpool('local', 12) >> Starting parallel pool (parpool) using the 'local' profile ... Error using parpool (line 103) You requested a minimum of 12 workers, but the cluster "local" has the NumWorkers property set to allow a maximum of 6 workers. To run a communicating job on more workers than this (up to a maximum of 512 for the Local cluster), increase the value of the NumWorkers property for the cluster. The default value of NumWorkers for a Local cluster is the number of cores on the local machine. ``` -------------------------------- ### SLURM Job Dependency: AfterAny in Job Script Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Defines a job dependency within a SLURM batch script using '#SBATCH --dependency=afterany:'. This ensures the job starts only after the specified JobID has finished. Ensure 'account_name' is replaced with a valid account. ```bash #!/bin/bash #SBATCH --time=00:30:00 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=16 #SBATCH --account=account_name # <- replace "account_name" with an account available to you #SBATCH --job-name="myjob" #SBATCH --partition=secondary #SBATCH --output=myjob.o%j #SBATCH --dependency=afterany: ``` -------------------------------- ### Get User ID (UID) for NFS Mounts Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Command to retrieve the user ID (UID) and group ID (GID) on a Linux system. This is important for ensuring consistent file access permissions when mounting research storage via NFS. ```bash [testuser1@cc-login ~]$ id uid=7861(testuser1) gid=7861(testuser1) groups=7861(testuser1) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 ``` -------------------------------- ### SLURM Chained Job Dependencies in Shell Script Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Submits a sequence of SLURM batch jobs where each subsequent job depends on the completion of the previous one. It captures the JobID of each submission to set the dependency for the next. This example shows a chain of three jobs. ```bash #!/bin/bash JOB_01=`sbatch jobscript1.sbatch |cut -f 4 -d " " ` JOB_02=`sbatch --dependency=afterany:$JOB_01 jobscript2.sbatch |cut -f 4 -d " " ` JOB_03=`sbatch --dependency=afterany:$JOB_02 jobscript3.sbatch |cut -f 4 -d " " ` ... ``` -------------------------------- ### MATLAB: Exceeding Max Workers for parpool Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This error occurs when attempting to start a 'parpool' with more workers than the cluster's 'NumWorkers' property allows. To resolve, increase the 'NumWorkers' property for the local cluster, which defaults to the number of CPU cores. ```matlab parpool('local', 24) >> Starting parallel pool (parpool) using the 'local' profile ... Error using parpool (line 103) You requested a minimum of 24 workers, but the cluster "local" has the NumWorkers property set to allow a maximum of 12 workers. To run a communicating job on more workers than this (up to a maximum of 512 for the Local cluster), increase the value of NumWorkers property for the cluster. The default value of NumWorkers for a Local cluster is the number of cores on the local machine. ``` -------------------------------- ### Check Local Linux System for OpenGL Support (xdpyinfo) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/x_window_system This command queries the X server for information about its capabilities, specifically checking for the presence of GLX, which is required for OpenGL rendering. The output should include 'GLX' if OpenGL support is available. ```bash xdpyinfo | grep GL ``` -------------------------------- ### List available Intel modules Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Use this command to display all available Intel compiler and Intel MPI modules on the Campus Cluster, helping users choose the appropriate version for their projects. ```bash module avail intel ``` -------------------------------- ### Create Directory for R Packages (Bash) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command creates a new directory in the user's home directory to store custom R packages. It is a prerequisite for setting up user-specific R library paths. ```bash mkdir ~/Rlibs ``` -------------------------------- ### Test X Window Display with xterm (X11 Forwarding) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/x_window_system This command launches an xterm terminal window, which serves as a basic test to verify that X11 forwarding is correctly configured and working. If the xterm window appears on your local machine, your X11 tunneling is successful. ```bash xterm ``` -------------------------------- ### Load R Module (Bash) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command loads a specific version of the R module onto the system. This ensures that the R environment is properly set up before running R commands or scripts. ```bash module load R/4.2.3 ``` -------------------------------- ### Configure R_LIBS in .bashrc for Persistent Setting (Bash) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This script snippet, intended for the ~/.bashrc file, ensures that the R_LIBS environment variable is set correctly upon login. It checks if R_LIBS is already set and prepends the user's R library directory accordingly, making user-specific package availability persistent. ```bash if [ -n $R_LIBS ]; then export R_LIBS=~/Rlibs:$R_LIBS else export R_LIBS=~/Rlibs fi ``` -------------------------------- ### Load the default R module into environment Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software Use this command to load the latest or default R module into your current shell environment, making the R programming language and its functionalities accessible. ```bash module load R ``` -------------------------------- ### Submit Interactive Batch Job with X11 Forwarding (Slurm) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/x_window_system This command submits an interactive batch job using Slurm, enabling X11 forwarding for graphical applications. The job is configured with specific resource requirements and will provide a bash shell on the compute node. ```bash srun -A account_name --x11 --export=All --time=00:30:00 --nodes=1 --ntasks-per-node=16 --partition=secondary --pty /bin/bash ``` -------------------------------- ### Load Module Environment on Cluster Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/faq This command loads a specified module file into the user's current environment on the Campus Cluster. Users should replace 'modulefile_name' with the actual name of the module they wish to use, such as a specific Python version or Anaconda distribution. ```shell module load modulefile_name ``` -------------------------------- ### Enable X11 Forwarding with SSH (Linux/macOS) Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/x_window_system This command enables X11 forwarding when connecting to a remote server via SSH. It allows graphical applications run on the remote server to display on your local machine. Ensure your local SSH client supports X11 forwarding. ```bash ssh -X user@remote_host ``` -------------------------------- ### Submit MATLAB Batch Job to Slurm Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/software This command demonstrates how to submit a MATLAB batch job to the Slurm workload manager on the Campus Cluster. It assumes a pre-configured Slurm batch script named `matlab.sbatch` is available, which handles the MATLAB execution on compute nodes. ```shell sbatch matlab.sbatch ``` -------------------------------- ### Query SLURM Node Features with sinfo Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Retrieves and displays features of SLURM nodes, including queue information, node names, and available features. The output is piped to 'more' for paginated viewing. This command helps identify compatible resources for job constraints. ```bash sinfo -N --format="%R (%N): %f" -S %R | more ``` -------------------------------- ### Test 3D Graphics Capability with glxgears Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/x_window_system The glxgears command tests the remote 3D graphics rendering capability through X Windows. It displays a box with rotating gears and shows the frame rate (FPS), indicating the performance of 3D work. If the gears do not appear, your X display may not support the GLX OpenGL extension. ```bash glxgears ``` -------------------------------- ### Requesting GPU Resources with SLURM Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Specifies how to request specific GPU types and quantities for SLURM jobs using the `--gres` flag. It covers different GPU models and the default quantity. Requesting more GPUs than available on a node will cause job failure. ```bash # Requesting a single V100 GPU --- gres=gpu:V100 # Requesting two V100 GPUs --- gres=gpu:V100:2 ``` -------------------------------- ### Checking GPU Availability in SLURM Partitions Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Demonstrates how to check for available GPUs within specific SLURM partitions. The command displays node names, allocated CPUs, GPU details, partition, and features, helping users determine resource availability. ```bash sinfo -p -N -o "%8N %4c %16G %25P %50f" ``` -------------------------------- ### Relocate .conda Directory to Project Space Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Commands to move the .conda directory from the home directory to a project space, which has a larger quota. This involves creating a new directory, copying data, removing the old directory, and creating a symbolic link to the new location. ```bash [testuser1@cc-login1 ~]$ mkdir -p /projects/illinois/$college/$department/$pi_netid//.conda ``` ```bash [testuser1@cc-login1 ~]$ rsync -aAvP ~/.conda/* /projects/illinois/$college/$department/$pi_netid//.conda/ ``` ```bash [testuser1@cc-login1 ~]$ rm -rf ~/.conda ``` ```bash [testuser1@cc-login1 ~]$ ln -s /projects/illinois/$college/$department/$pi_netid//.conda ~/.conda ``` -------------------------------- ### View Filesystem Usage with Quota Command Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data The 'quota' command provides a summary of a user's filesystem usage across various directories and project spaces. The output details user and project block usage, file counts, and soft/hard limits for both capacity and inodes. Data is updated approximately every 15 minutes. ```bash [testuser1@cc-login1 ~]$ quota Directories quota usage for user testuser1: ----------------------------------------------------------------------------------------------------------- | Fileset | User | User | User | Project | Project | User | User | User | | | Block | Soft | Hard | Block | Block | File | Soft | Hard | | | Used | Quota | Limit | Used | Limit | Used | Quota | Limit | ----------------------------------------------------------------------------------------------------------- | labgrp1 | 160K | 1T | 1T | 58.5G | 1T | 6 | 20000000 | 20000000 | | home | 36.16M | 5G | 7G | 58.5G | 1T | 1180 | 0 | 0 | | scratch | 2.5M | 20T | 20T | 58.5G | 1T | 15292 | 0 | 0 | | labgrp2 | 0 | 60T | 60T | 54.14T | 60T | 1 | 20000000 | 20000000 | | labgrp3 | 0 | 107T | 107T | 88.31T | 107T | 11 | 20000000 | 20000000 | ----------------------------------------------------------------------------------------------------------- ``` -------------------------------- ### Check Python Module Availability on Cluster Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/faq These commands are used to list available Python and Anaconda modules on the Campus Cluster. Users can run these commands to determine which scientific and numeric Python packages are accessible and can be loaded into their environment. ```shell module avail python ``` ```shell module avail anaconda ``` -------------------------------- ### Monitoring SLURM Job Status with squeue Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Illustrates various `squeue` commands for monitoring SLURM batch jobs. It covers listing all jobs, user-specific jobs, jobs by ID, and obtaining detailed job information using `scontrol`. ```bash # List all jobs on the system squeue -a # List status of all your jobs squeue -u $USER # List nodes allocated to a running job squeue -j JobID # List detailed information on a particular job scontrol show job JobID ``` -------------------------------- ### Connect to Host via SSH in VS Code Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/prog_env This snippet details the command and input required to establish an SSH connection to a remote host using VS Code's Remote - SSH extension. It involves using a keyboard shortcut to open the command palette, selecting the connect option, and providing the username and hostname. ```text Ctrl+Shift+P (or Cmd+Shift+P) Remote-SSH: Connect to Host… username@hostname 1 (for Duo push) ``` -------------------------------- ### Compress Folder with tar and gzip Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data Command to compress a folder into a single tar.gz archive using tar and gzip. This is useful for data transport and reducing storage space. ```bash [testuser1@cc-login hubble]~ tar -zcvf images_bundle.tar.gz images ``` -------------------------------- ### List Files Command Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data This command lists the contents of a directory, showing files and subdirectories. It can also display archive files. ```bash ls ``` -------------------------------- ### Prevent Environment Variable Conflicts in Apptainer Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/containers This section outlines methods to prevent Apptainer from passing host environment variables that might interfere with build processes inside the container, such as compiler and MPI variables. Unloading modules or using the `--cleanenv` option are recommended strategies. This is applicable when building software within the container that relies on specific compiler or MPI configurations. ```bash # Option 1: Unload conflicting modules module unload gcc openmpi # Option 2: Run Apptainer with clean environment apptainer run --cleanenv ``` -------------------------------- ### Shell: Remove Group Writable Permissions Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Removes group writable permissions from a home directory to resolve 'Permission Denied' errors. This is often necessary when group writable permissions on the home directory cause SSH authentication failures. ```shell [golubh1 ~]$ chmod g-w ~jdoe ``` -------------------------------- ### Run Multiple Matlab Instances Concurrently in Slurm Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs This Slurm script executes 16 instances of Matlab concurrently within a single batch job. It leverages the '--ntasks-per-node=16' option and uses a for loop to launch each Matlab process in the background, followed by a 'wait' command. Ensure 'module load matlab' is executed and replace 'account_name' appropriately. ```bash #!/bin/bash #SBATCH --time=00:30:00 # Job run time (hh:mm:ss) #SBATCH --account=account_name # Replace "account_name" with an account available to you #SBATCH --nodes=1 # Number of nodes #SBATCH --ntasks-per-node=16 # Number of task (cores/ppn) per node #SBATCH --job-name=matlab_job # Name of batch job #SBATCH --partition=secondary # Partition (queue) #SBATCH --output=multi-serial.o%j # Name of batch job output file cd ${SLURM_SUBMIT_DIR} module load matlab for (( i=1; i<=16; i++)) do matlab -nodisplay -r num.9x2.$i > output.9x2.$i & done wait ``` -------------------------------- ### Execute Multiple Serial Processes in a Single Slurm Job Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs This Slurm script demonstrates how to run multiple serial processes within a single batch job by setting `--ntasks-per-node` to the maximum number of available cores. Processes are backgrounded using '&' and then explicitly waited upon using the 'wait' command to ensure the job completes all tasks. This is ideal for processes with similar execution times. ```bash #!/bin/bash #SBATCH --time=00:05:00 # Job run time (hh:mm:ss) #SBATCH --account=account_name # Replace "account_name" with an account available to you #SBATCH --nodes=1 # Number of nodes #SBATCH --ntasks-per-node=16 # Number of task (cores/ppn) per node #SBATCH --job-name=multi-serial_job # Name of batch job #SBATCH --partition=secondary # Partition (queue) #SBATCH --output=multi-serial.o%j # Name of batch job output file executable1 & executable2 & . . . executable16 & wait ``` -------------------------------- ### SLURM Job Dependency: AfterAny Command Line Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Sets a SLURM job to run only after a specified job has completed, regardless of its success or failure. Uses the 'afterany' dependency type. The JobID must be replaced with the actual ID of the preceding job. ```bash sbatch --dependency=afterany: jobscript.sbatch ``` -------------------------------- ### Remove Directory Command Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/storage_data This command recursively removes a directory and its contents. Use with caution as it is irreversible. ```bash rm -rf images ``` -------------------------------- ### Submit Multiple Serial Jobs Concurrently with Slurm Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs This Slurm script configures a job to run multiple serial jobs concurrently on a single node by utilizing the `--mem-per-cpu` and `--ntasks-per-node` options. It specifies resource allocation like time, account, nodes, and memory per CPU. Ensure to replace 'account_name' with a valid account. ```bash #!/bin/bash #SBATCH --time=00:05:00 # Job run time (hh:mm:ss) #SBATCH --account=account_name # Replace "account_name" with an account available to you #SBATCH --nodes=1 # Number of nodes #SBATCH --ntasks-per-node=1 # Number of task (cores/ppn) per node #SBATCH --mem-per-cpu=3375 # Memory per core (value in MBs) # cd ${SLURM_SUBMIT_DIR} # Run the serial executable ./a.out < input > output ``` -------------------------------- ### SLURM Job Array Submission with Slot Limit Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Submits a job array where a maximum of 5 tasks can run concurrently. The '--array' option specifies the range of task IDs, and the '%5' limits the parallelism. Job array tasks can be differentiated using the SLURM_ARRAY_TASK_ID environment variable. ```bash sbatch --array 1-100%5 jobscript.sbatch ``` -------------------------------- ### Conditional Output in .bashrc for SFTP Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/faq This code snippet demonstrates how to conditionally execute commands in a .bashrc file to prevent SFTP 'Received message too long' errors. It ensures that commands producing terminal output are only run when the shell is interactive, thus avoiding unexpected data in SFTP transfers. ```shell if tty -s; then ; fi ``` -------------------------------- ### Canceling SLURM Jobs with scancel Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/running_jobs Explains the `scancel` command used to delete queued or kill running SLURM jobs. A simple command is provided to remove a job based on its JobID. ```bash scancel JobID ``` -------------------------------- ### Access Integrated Terminal in VS Code Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/prog_env This snippet shows the keyboard shortcut to open the integrated terminal within VS Code. Once opened, users can execute commands directly on the remote cluster. ```text Ctrl+Backtick(`) ``` -------------------------------- ### Change Default Group Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/acct_admin Changes the default group ownership of the home directory to a specified group. The change will be active after logging out and back in. ```bash chgrp defgroupname $HOME ``` -------------------------------- ### Change Default Shell to tcsh Source: https://docs.ncsa.illinois.edu/systems/icc/en/latest/user_guide/acct_admin Modifies the default user shell to tcsh by adding a command to the .bash_profile file. This change requires a logout and login to take effect. ```bash exec -l /bin/tcsh ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.