If your application is already integrated with FFTW or AMD-FFTW, AOCL-FFTZ library can be loaded directly at runtime. You must build and link FFTW-WRAPPERS along with AOCL-FFTZ for this scenario.
In this and the next section, the following terms are used:
path to aocl-fftz lib — your install
lib/directory (e.g.<aocl-fftz_install-path>/lib).FFTW wrapper — the
libfftw3/libfftw3flibraries generated when building AOCL-FFTZ with wrapper support.
Follow these steps to integrate AOCL-FFTZ into your application at Runtime:
On Linux: LD_PRELOAD is an environment variable in Unix-based operating
systems, which allows you to specify one or more shared libraries to be
loaded before any other library. Use LD_PRELOAD as follows when launching
the application:
# Since fftw3 (fftw wrapper library) depends on aocl_fftz, ensure that the dynamic linker can find it
export LD_LIBRARY_PATH="<path to aocl-fftz lib>":$LD_LIBRARY_PATH
# LD_PRELOAD the application with the path to the fftw3 (fftw wrapper) library
# (libfftw3.so for double-precision, or libfftw3f.so for single-precision)
LD_PRELOAD="<path to aocl-fftz lib>/libfftw3.so" your_application_executable
# Alternatively: LD_PRELOAD=libfftw3.so or libfftw3f.so (with LD_LIBRARY_PATH set to the lib directory as above)
Example: Integration with VASP
The Vienna Ab initio Simulation Package (VASP) is a computer program for atomic scale materials modelling, e.g. electronic structure calculations and quantum-mechanical molecular dynamics, from first principles. If VASP has been configured to use FFTW or AMD-FFTW, it can be re-directed to load AOCL-FFTZ library at runtime as follows:
# Export aocl_fftz library so that the dynamic linker can find it
export LD_LIBRARY_PATH="<path to aocl-fftz lib>":$LD_LIBRARY_PATH
# Run VASP while pre-loading the fftw3 wrapper library (libfftw3.so or libfftw3f.so as appropriate)
LD_PRELOAD="<path to aocl-fftz lib>/libfftw3.so" vasp_std