ispc
Overview
ISPC is an open-source compiler from Intel for a variant of the C programming language, with extensions for “single program, multiple data” (SPMD) programming. It compiles a C-based SPMD programming language to run on the SIMD units of CPUs. It frequently provides a 3x or more speedup on CPUs with 4-wide vector SSE units and 5x-6x on CPUs with 8-wide AVX vector units, without any of the difficulty of writing intrinsics code. Parallelization across multiple cores is also supported by ispc, making it possible to write programs that achieve performance improvement that scales by both number of cores and vector unit size.
You will typically compile specific source files with ispc to obtain performance for the routines in that source. Other components of the application can be compiled with GNU (gcc/g++) or Intel (icc/icpc) compilers.
Version 1.11.0 is installed on the CSF.
Restrictions on use
There are no restrictions on access the software on the CSF. Details of the licences under which various components of the software are released are available on the ispc github page and all usage must adhere to these licenses.
Set up procedure
We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job inherit these settings.
Load one of the following modulefiles:
module load compilers/intel/ispc/1.11.0
Note that you DO NOT need to load the ispc modulefile when running an executable in the batch system. If you have used any other libraries or compilers which required the modulefile to be loaded for compilation then you will have to load those modulefiles in your jobscripts when running in the batch system.
Example Code
The modulefile will set the environment variable ISPC_EXAMPLES
which gives the directory within the central install containing the source code examples. You may take a copy of this area (it isn’t very big). For example:
module load compilers/intel/ispc/1.11.0 mkdir ~/my_ispc_apps cd ~/my_ispc_apps rsync -av $ISPC_EXAMPLES . # Now compile one of the examples - the mandelbrot example cd mandelbrot make
Note that the example code will be compiled for multiple Instruction Set Architectures (ISA) and width – the flags to do this are added to the compiler command-line by the example Makefile
(check the output of the make
command above).
You are strong recommended to consult the ISPC online manual, particularly the section on selecting the target architecture. If you do not specify any architecture flags the ispc compiler will detect the CPU you are currently running on and compile for the most capable features of that CPU. The CPUs in the CSF differ between compute nodes and login nodes. The compute nodes have different architectures so we recommend you always specify explicitly the target architectures when compiling. Another method would be to do the compilation within a batch job and ensure you specify exactly which type of compute node you want job to land on, which will force the compiler to compile for that architecture.
Providing further instructions on using the ispc compiler is beyond the scope of this webpage. You should read the ispc online documentation (see links at bottom of this page).
Running your Compiled Code
You may run ispc
on the login nodes to compile your software. However, running the executables generated by the compiler should be done in the batch system (just like any other application). If you wish to interactively compile and run, please use an interactive session via the qrsh command, requesting an appropriate number of cores for your tests.
Serial batch job submission
Create a batch submission script (which will load the modulefile in the jobscript), for example:
#!/bin/bash --login #$ -cwd # Job will run from the current directory # NO -V line - we load modulefiles in the jobscript # Load any required modulefiles in the jobscript (use your required version). # NOTE: you DO NOT need to load the ispc modulefile to run an executable # compiled by ispc. # module load libs/..... # Run your compiled app ./myapp arg1 arg2
Submit the jobscript using:
qsub scriptname
where scriptname is the name of your jobscript.
Parallel batch job submission
Create a batch submission script (which will load any required modulefiles in the jobscript), for example:
#!/bin/bash --login #$ -cwd # Job will run from the current directory #$ -pe smp.pe 8 # Number of cores. Can be 2--32. # Load any required modulefiles in the jobscript (use your required version). # NOTE: you DO NOT need to load the ispc modulefile to run an executable # compiled by ispc. # module load libs/..... # Run your compiled app ./myapp arg1 arg2 ...
Submit the jobscript using:
qsub scriptname
where scriptname is the name of your jobscript.
Further info
Updates
None.