Skip to content

Linking Focal Programs

Include

To use the Focal module in your own code, include the module with the use syntax:

program myprogram
use Focal
implicit none
...
end program myprogram

Compile

To compile a program using the Focal module, you must point the compiler to the mod/Focal.mod definition in the Focal repository. For example, in gfortran this is done with the -I flag:

$> gfortran -c myprogram.f90 -I/path/to/focal/mod/ -o myprogram.o

To link, you need to specify the path to the Focal repository and directives for Focal and OpenCL:

$> gfortran myprogram.o -L/path/to/focal/lib/ -lFocal -lOpenCL -o bin/myprogram

See examples in the repository for how this can be done with a makefile.

Debug build

When the Focal library is built, two versions are produced: libFocal and libFocaldbg where the latter contains additional runtime calls that check the validity of your program.

To link against the debug build replace -lFocal with -lFocaldbg in the linking command. See here for more information on runtime debug checks.