PSCF v1.1
|
Source Code (Prev) Environment Variables (Next)
Below is a brief overview of instructions for compiling all of the PSCF programs using default settings. The directions given here and in subsequent pages assume that you have already cloned the pscfpp repository and installed all required dependencies. The descriptions assume that the root directory of the repository is named pscfpp/. You are free to rename the root directory before running or rerunning the setup script.
Below, have divided the instructions i 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.
The following steps must be taken after installing required dependencies but before atttempting to compile any part of PSCF:
Setup: Invoke the "setup" script from the pscfpp/ root directory. To setup the build system with default compiler options appropriate to most linux systems, enter the command
from the root directory. Note the use of the prefix "./" before the name of the script, which indicates that the operating system should look for this script in the present working directory.
Alternatively, to customize compiler options, one may invoke the setup script with a filename argument that is the name of a compiler configuration file that contains non-default compiler options, as discussed here). An environment appropriate for compiling on a Mac OS X system with Apple silicon hardware (e.g., an M1 or M2 chip) in which the dependencies were installed using the homebrew package mamager can be created by entering
from the pscfpp/ directory.
We recommend that users first compile only the programs in PSCF that use standard CPU hardware, leaving compilation GPU-enabled C++/CUDA programs as a separate step.
Compilation of GPU-enabled CUDA code is disabled by default after the setup operation described above. To compile only C++ CPU programs, but no GPU-enabled code, you may simply enter
from the pscfpp/ directory immediately after running the setup script.
If successful, this will install executables named "pscf_fd", "pscf_pc1", "pscf_pc2" and "pscf_pc3" in the pscfpp/bin directory.
Compiling all the PSCF C++ code using "make all" takes a little 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 PSCF.
Entering "make all" or "make -jn all" from the pscfpp/ root directory, as described above, will create a large number of intermediate object (*.o), dependency (*.d) and library (*.a) files in subdirectories of the pscfpp/bld directory, in addition to the executable files that are created in the pscfpp/bin directory.
The GPU-enabled C++/CUDA programs provided as part of PSCF can only be compiled on computers that have an NVIDIA development kit installed, and can only be run on machines that have an appropriate NVIDIA GPU and CUDA driver software. Before compiling this code, the user must 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 setup 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 pscfpp/ root directory. If you later want to disable compilation of CUDA code, instead enter
Commands issued by the configure script set variables that affect subsequent behavior of the build system and compiler. Usage of the configure script is discussed in more detail here.
To check if CUDA compilation is currently enabled, change directory to the pscfpp/bld directory, and enter
from that directory. This should yield a report indicating whether the "debugging" and "CUDA" options are currently set to be enabled (ON) or disabled (OFF) for code built in the bld/ directory (the default build directory).
If successful, the "make all" command will install executables files named "pscf_pg1", "pscf_pg2" and "pscf_pg3" in the pscfpp/bin directory in addition to the files "pscf_fd", "pspc_pc1", "pscf_pc2" and "pscf_pc3" that are created by compiling only C++ code.
Several of the above steps is discussed in more detail in the following 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 pscfpp/bld directory tree. It is also possible to perform an "in-source" build in which these files are instead placed in the pscfpp/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 the use of out-of-source compilation for package users who are not actively working on development. Some developers may find in-source compilation more convenient during development.
Source Code (Prev) Installation (Up) Environment Variables (Next)