Under Microsoft Windows(R) , for the g77/gcc version of ACML it is assumed that you have the Cygwin UNIX-like tools installed (see http://www.cygwin.com/), including the g77/gcc compiler and associated tools. Assuming you have installed the ACML in the default place, then in a DOS command prompt window, the command
g77 driver.f "c:\Program Files\AMD\acml2.5.0\gnu32\libacml.a"
can be used to link the application program driver.f to the static library version of the ACML.
The g77 version of the ACML Library is supplied in both static and shareable versions, libacml.a and libacml.dll, respectively. The command given above links to the static version of the library, libacml.a. To link to the DLL version, the command
g77 driver.f "c:\Program Files\AMD\acml2.5.0\gnu32\libacml.dll"
can be used. Notice that if the application program has been linked
to the DLL version of the ACML Library, then before running the program, the
environment variable PATH
must have been set to include the
location of the DLL, for example by the DOS command:
PATH="c:\Program Files\AMD\acml2.5.0\gnu32";%PATH%
where it was assumed that libacml.dll was installed in the directory "c:\Program Files\AMD\acml2.5.0\gnu32". Alternatively, the PATH environment variable may be set in the system category of the Windows control panel.
The command
gcc "-Ic:\Program Files\AMD\acml2.5.0\include" driver.c "c:\Program Files\AMD\acml2.5.0\gnu32\libacml.a" -lg2c
will compile driver.c and link it to the 32-bit g77/gcc version of ACML. The switch "-Ic:\Program Files\AMD\acml2.5.0\include" tells the gcc compiler to search directory "c:\Program Files\AMD\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.
To use the 32-bit Windows PGI version of ACML, use a command like
pgf77 -Mcache_align driver.f "c:\Program Files\AMD\acml2.5.0\pgi32\libacml.a"
or
pgcc -c "-Ic:\Program Files\AMD\acml2.5.0\include" -Mcache_align driver.c pgcc -Mcache_align driver.o "c:\Program Files\AMD\acml2.5.0\pgi32\libacml.a" -lpgftnrtl -lpgsse1 -lpgsse2 -lm
Note that in the example we link the program with -lpgftnrtl -lpgsse1 -lpgsse2 -lm so that required PGI run-time libraries are located.
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 -mp -Mcache_align driver.f "c:\Program Files\AMD\acml2.5.0\pgi32\libacml.a"
Note that the location of the ACML is now specified as 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 -mp flag is also required if you compile and link a C program to the pgi32_mp libraries.
To use the 32-bit Windows MSC/CVF version of ACML, use a command like
cvf /threads /libs:dll driver.f "c:\Program Files\AMD\acml2.5.0\win32\libacml_dll.lib"
where libacml_dll.lib is the import library for the ACML DLL,
or
cl "-Ic:\Program Files\AMD\acml2.5.0\include" /Gz /MD driver.c "c:\Program Files\AMD\acml2.5.0\win32\libacml_dll.lib"
where cvf is the Compaq Visual Fortran command line compiler and cl is the Microsoft C command line compiler. The flag /Gz used on the C compiler command line is important - it tells it to use the _stdcall calling convention rather than the default Microsoft C __cdecl calling convention. All ACML user-callable routines were built using _stdcall to ensure that the ACML DLL is easily accessible from any language compatible with that convention (for example, Microsoft Visual Basic or Microsoft C#).
ACML can also be linked from inside a development environment such as Microsoft Visual Studio or Visual Studio.NET. Again, it is important to get compilation options correct. The directory acml2.5.0\win32\examples\Projects contains a few sample Visual Studio project directories showing how this can be done.
Note that in both examples above we linked to a DLL version of ACML,
and so before running the resulting programs the
environment variable PATH
must be set to include the
location of the DLL, for example by the DOS command:
PATH="c:\Program Files\AMD\acml2.5.0\win32";%PATH%
where it is assumed that libacml_dll.dll was installed in the directory "c:\Program Files\AMD\acml2.5.0\win32". Alternatively, the PATH environment variable may be set in the system category of the Windows control panel.
ACML also comes as a static (non-DLL) library, named libacml.lib, in the same directory as the DLL. If you link to the static library instead of the DLL import library then there is no need to set the PATH.
Under 64-bit versions of Windows, ACML 2.5.0 comes only as a static (.LIB) library for single processor machines (the library can be used on an SMP machine but will not take advantage of more than one processor). The compiler can be used with the PGI compilers pgf77/pgf90/pgcc or with the Microsoft C compiler, though with the latter compiler it is necessary also to link with PGI run-time libraries.
To link with the 64-bit Windows version of ACML, in a DOS command prompt use a command like
pgf77 driver.f c:/Program Files/AMD/acml2.5.0/win64/libacml.lib
or, for a C program,
pgcc driver.c -Ic:/Program Files/AMD/acml2.5.0/include c:/Program Files/AMD/acml2.5.0/win64/libacml.lib -lpgftnrtl -lm
Note that in the C example we link the program with -lpgftnrtl -lm so that required PGI run-time libraries are located.
To use the Microsoft C command line compiler, cl, use a command like this:
cl driver.c -Ic:/Program Files/AMD/acml2.5.0/include c:/Program Files/AMD/acml2.5.0/win64/libacml.lib c:/usr/pgi/win64/1.0/lib/libpgftnrtl.lib c:/usr/pgi/win64/1.0/lib/libpgc.lib
The references to libpgftnrtl.lib and libpgc.lib must point at the location of an installed copy of the PGI compilers.