|
PSCF v1.4.0
|
Configure Script (Prev) Out-of-Source and In-Source Builds (Next)
This page contains instructions for compiling the PSCF package using default settings, after completing all required preliminary steps. We have divided the instructions into a set of instructions for compiling and installing the programs that use only CPU hardware, and additional instructions for compiling programs that use an NVIDIA GPU.
We recommend that users first attempt to compile only the CPU programs, leaving compilation of the GPU-enabled programs to a separate step.
Compilation of GPU-enabled code is disabled by default. To compile only the pscf_r1d and pscf_rpc CPU programs, you may simply enter
from the PSCF directory immediately after running the configure script. If successful, this will install executables named "pscf_r1d" and "pscf_rpc" in the PSCF bin/ directory.
Compiling all the PSCF C++ code using "make all" takes a bit of time (e.g., 2 to 3 minutes on a 2020 Mac air laptop with an M1 chip). This can be completed more quickly on a multi-core machine by using the -j option of the "make" command to use multiple CPU cores in parallel to compile different C++ files. The argument of the -j option is the number of cores that should be used, if available. For example, you could enter
to use all 8 CPU cores of an 8-core computer to compile.
Entering "make all" or "make -jn all" from the PSCF root directory, as described above, will create a large number of intermediate object (*.o), dependency (*.d) and library (*.a) files in subdirectories of the PSCF bld/ directory, in addition to the executable files that are created in the PSCF bin/ directory.
The GPU-enabled pscf_rpg program can only be compiled on computers that have an NVIDIA CUDA development kit installed, and can only be run on machines that have an appropriate CUDA-capable NVIDIA GPU and CUDA driver software installed. Before compiling pscf_rpg, the user must first enable compilation of CUDA code and set the appropriate target GPU architecture, as described below. The following instructions assume that you have already completed the preliminary steps described above.
Enable compilation of GPU-enabled programs: To enable compilation of CUDA code for GPU-enabled programs on a machine that is set up to allow this, enter
from the PSCF root directory. If you later want to disable compilation of CUDA code, instead enter
Commands issued by the setops script set variables that affect subsequent behavior of the build system and compiler. Usage of the setopts script is discussed in more detail here.
To check if CUDA compilation is currently enabled, change directory to the PSCF bld/ directory, and enter
from that directory. This should yield a report that indicates (among other things) whether the "CUDA" options is currently set to be enabled (ON) or disabled (OFF) for code built in the bld/ directory (the default build directory).
Set the target GPU architecture: CUDA must be compiled for a particular target GPU architecture. To set the target architecture to correspond to the GPU on your computer, you must change directory to PSCF root directory and issue a command of the form
where [architecture id] denotes a string that identifies the architecture of the GPU for which you are compiling. Valid values of this string have the form "sm_IJ", where IJ denotes a integer string that represents the NVIDIA "compute capability" for the target GPU. You can look up the compute capabability for the type of NVIDIA GPU installed on your computer by consulting the NVIDIA developer documentation. The compute capability for an NVIDIA GPU is a number of the form I.J in which I is an integer major version number and J is a minor version number. The architecture id required as an argument of the -a option, however, uses a string of the form sm_IJ that drops the dot between the major and minor version.
For example, an NVIDIA A100 GPU has a compute capability of 8.0. To set this as the target architecture, one would enter
from the PSCF root directory, using "sm_80" as the architecture id.
By default, the target architecture is set to compute capability 7.0 , or sm_70, which is the appropriate level for a slightly older V100 GPU.
If successful, the "make all" command will install an executable file named pscf_rpg in the PSCF bin/ directory in addition to the executable files named pscf_r1d and pscf_rpc that are created by compiling only C++ code.
Several of the above steps are discussed in more detail in subsequent pages.
The above instructions explain how to perform an "out-of-source" build in which intermediate files created during compilation process are placed in the PSCF bld/ sub-directory tree. One can instead perform an "in-source" build in which these files are instead placed in the PSCF src/ directory that also contains all C++ and CUDA source code files. The option of in-source compilation is discussed in more detail here. We recommend out-of-source compilation for users who are not actively working on development. Some programmers may prefer to use in-source compilation during development.
Configure Script (Prev) Installation (Up) Out-of-Source and In-Source Builds (Next)