If the Linux 64-bit g77 version of ACML was installed in the default directory, /opt/acml2.5.0/gnu64, then the command:
g77 -m64 driver.f -L/opt/acml2.5.0/gnu64 -lacml
can be used to compile the program driver.f and link it to the ACML.
The ACML Library is supplied in both static and shareable versions, libacml.a and libacml.so, respectively. By default, the commands given above will link to the shareable version of the library, libacml.so, if that exists in the directory specified. Linking with the static library can be forced either by using the compiler flag -static, e.g.
g77 -m64 driver.f -L/opt/acml2.5.0/gnu64 -static -lacml
or by inserting the name of the static library explicitly in the command line, e.g.
g77 -m64 driver.f /opt/acml2.5.0/gnu64/libacml.a
Notice that if the application program has been linked
to the shareable ACML Library, then before running the program, the
environment variable LD_LIBRARY_PATH
must be set,
for example, by the C-shell command:
setenv LD_LIBRARY_PATH /opt/acml2.5.0/gnu64
where it is assumed that libacml.so was installed in the directory
/opt/acml2.5.0/gnu64
(see the man page for ld(1) for more information
about LD_LIBRARY_PATH
.).
The command
g77 -m32 driver.f -L/opt/acml2.5.0/gnu32 -lacml
will compile and link a 32-bit program with a 32-bit ACML.
The command
gcc -m64 -I/opt/acml2.5.0/include driver.c -L/opt/acml2.5.0/gnu64 -lacml -lg2c
will compile and link a 64-bit C program with a 64-bit ACML, using the switch "-I/opt/acml2.5.0/include" to tell the compiler to search directory /opt/acml2.5.0/include for the ACML C header file acml.h, which should be included by driver.c. Note that it is necessary to add the compiler run-time library -lg2c when linking the program.
Similar commands apply for the PGI versions of ACML. For example,
pgf77 -tp=k8-64 -Mcache_align driver.f -L/opt/acml2.5.0/pgi64 -lacml pgf77 -tp=k8-32 -Mcache_align driver.f -L/opt/acml2.5.0/pgi32 -lacml
will compile driver.f and link it to the ACML using 64-bit and 32-bit versions respectively. In the example above we are linking with the single-processor PGI version of ACML.
If you have an SMP machine and want to take best advantage of it, link against the PGI OpenMP version of ACML like this:
pgf77 -tp=k8-64 -mp -Mcache_align driver.f -L/opt/acml2.5.0/pgi64_mp -lacml pgf77 -tp=k8-32 -mp -Mcache_align driver.f -L/opt/acml2.5.0/pgi32_mp -lacml
Note that the location of the ACML is now specified as pgi64_mp or pgi32_mp. The -mp flag is important - it tells pgf77 to link with the appropriate compiler OpenMP run-time library. Without it you might get an "unresolved symbol" message at link time. The -Mcache_align flag is also important - it tells the compiler to align objects on cache-line boundaries.
The commands
pgcc -c -tp=k8-64 -mp -Mcache_align -I/opt/acml2.5.0/include driver.c pgcc -tp=k8-64 -mp -Mcache_align driver.o -L/opt/acml2.5.0/pgi64_mp -lacml -lpgftnrtl -lm
will compile driver.c and link it to the 64-bit ACML. Again, the -mp flag is important if you are linking to the PGI OpenMP version of ACML. The switch "-I/opt/acml2.5.0/include" tells the C compiler to search directory /opt/acml2.5.0/include for the ACML C header file acml.h, which should be included by driver.c. Note that in the example we add the libraries -lpgftnrtl and -lm to the link command, so that required PGI compiler run-time libraries are found.
The 32-bit ACML libraries come in several versions, applicable to hardware with or without SSE instructions (Streaming SIMD Extensions), and it is important to link to a library that is appropriate to your hardware. The variant library versions are distinguished by being in directories with different names.
It may be possible to link to the g77/gcc versions of ACML using other compilers, if they are compatible with g77/gcc. An important thing to note is that you will need to link in required compiler run time libraries. An example using the 32-bit Intel FORTRAN compiler ifc might look like this:
ifc driver.f -L/opt/acml2.5.0/gnu32 -lacml /usr/lib/libg2c.so
where /usr/lib/libg2c.so is required to resolve g77 compiler run-time library symbols.