I have been trying out the amgX library. However, if I stick to the examples from the manual, I cannot compile my test program. Your example shows to include the ‘amgx_c.h’ header file, which is not included in the tar ball.

When compiling your examples with the supplied Makefile, compilation works fine, however, if I want to execute the example, it will print an error that the library file is not found, no matter if I put the library argument or not.

Any suggestions?

Sounds like you have an earlier version of the download, you are right the amgx_c.h header was missing. We have added this in the update, you can grab the latest from

If you are using Linux, you should add the path to to your LD_LIBRARY_PATH environment variable, this will tell the system were to find it at runtime. If you plan on using AmgX repeatedly, I recommend you add a line like
“export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_to_amgx_lib” to your .profile so it will be automatically set up for you when you login.

Please use header file ‘amgx_capi.h’ instead of ‘amgx_c.h’. You can take advantage of the provided examples to see how to use it in more detail.

Also, please setup the environment variable LM_LICENSE_FILE to point to the license file amgx_trial.lic you should have downloaded together with the build package. This is required for the library to work.

The amgx_c.h is still not in the package.

I did that. However, no matter what I do, I get the error message ‘Cannot load nvamg library’ (path to the library is 100% correct).

To go further, can you give us some idea of your environment and Cuda version? What OS are you using, and which example are you working with to get started? If you paste the example code and your environment variables we can help get them right. We have tested this extensively and we don’t think there is a problem with the library itself, but you may have found something we don’t know about yet. :)

I am using Scientific Linux 6.3 with CUDA 5.0 and K20 attached to the system. I simply try to run the provided example file. Environment variables are set.
declare -x LM_LICENSE_FILE="/home/nico/work/amgx/amgx_trial.lic"
declare -x LD_LIBRARY_PATH="/home/nico/work/amgx/lib:/usr/local/cuda/lib64:/usr/lib64/openmpi/lib"

I can compile it using the Makefile, however, when I execute it by
“~/work/amgx/examples$ ./amgx_capi_dynamic -l …/lib/ -help”
it prints me the message “Cannot load nvamg library”.

To be more precise:

nico:~/work/amgx$ ll
total 24
drwxr-xr-x 5 nico nico 4096 Dez 9 10:18 ./
drwxr-xr-x 34 nico nico 4096 Dez 9 09:20 …/
-rw-r–r-- 1 nico nico 225 Dez 9 09:20 amgx_trial.lic
drwxr-xr-x 2 nico nico 4096 Nov 26 00:35 configs/
drwxr-xr-x 2 nico nico 4096 Nov 26 19:10 examples/
drwxr-xr-x 2 nico nico 4096 Nov 26 00:30 lib/
nico:~/work/amgx$ export LM_LICENSE_FILE=/home/nico/work/amgx/amgx_trial.lic
nico:~/work/amgx$ export LD_LIBRARY_PATH=/home/nico/work/amgx/lib:LD_LIBRARY_PATH nico:~/work/amgx cd examples/
nico:~/work/amgx/examples$ make
gcc -O2 -std=c99 amgx_capi_dynamic.c -c -I/usr/local/cuda/include
g++ -O2 amgx_capi_dynamic.o -o amgx_capi_dynamic -L/usr/local/cuda/lib64 -lcudart -ldl -Wl,-rpath=…/lib
nico:~/work/amgx/examples$ ./amgx_capi_dynamic
Usage: ./nvamg_capi [-help] [-mode [hDDI | hDFI | hFFI | dDDI | dDFI | dFFI] [-l lib_path] [-m mformat mfile] [-amg “variable1=value1 variable2=value2 … variable3=value3”] [-c config_file]
-help display the command options
-m mfile: reads matrix stored in file mfile
-mode : which of the solver modes to use
-l specify nvamg library path
-c set the amg solver options from the configuration file
-amg set the amg solver options. Options include the following:
nico:~/work/amgx/examples$ ./amgx_capi_dynamic -help
Cannot load nvamg library
nico:~/work/amgx/examples$ ./amgx_capi_dynamic -help -l …/lib/
Cannot load nvamg library
nico:~/work/amgx/examples$ ./amgx_capi_dynamic -help -l …/lib/
Cannot load nvamg library
nico:~/work/amgx/examples$ ./amgx_capi_dynamic -help -l /home/nico/work/amgx/lib/
Cannot load nvamg library
nico:~/work/amgx/examples$ ./amgx_capi_dynamic -help -l /home/nico/work/amgx/lib/
Cannot load nvamg library

Can you post the output of commands “ldd” and “ldd amgx_capi_dynamic”?

nico:~/work/amgx/lib$ ldd
ldd: warning: you do not have execution permission for ./' ./ /usr/lib64/ version GLIBCXX_3.4.14’ not found (required by ./ => (0x00007fff28784000) => /usr/local/cuda/lib64/ (0x00007fbfd6888000) => /usr/lib64/ (0x00007fbfd58fb000) => /lib64/ (0x00007fbfd56f7000) => /usr/local/cuda/lib64/ (0x00007fbfd1d00000) => /usr/local/cuda/lib64/ (0x00007fbfc9d26000) => /usr/lib64/ (0x00007fbfc9a20000) => /lib64/ (0x00007fbfc979c000) => /lib64/ (0x00007fbfc9585000) => /lib64/ (0x00007fbfc91f1000) => /lib64/ (0x00007fbfc8fd4000) => /lib64/ (0x00007fbfc8dcb000) => /lib64/ (0x00007fbfc8bb5000)
/lib64/ (0x0000003b67000000)

nico:~/work/amgx/examples$ ldd amgx_capi_dynamic => (0x00007fff82f40000) => /usr/local/cuda/lib64/ (0x00007f3e57380000) => /lib64/ (0x0000003b67c00000) => /usr/lib64/ (0x0000003b6e400000) => /lib64/ (0x0000003b67800000) => /lib64/ (0x0000003b6d000000) => /lib64/ (0x0000003b67400000) => /lib64/ (0x0000003b68000000) => /lib64/ (0x0000003b68800000)
/lib64/ (0x0000003b67000000)

We are using an older version of glib, do you think this is causing the issue?

Yes, I think that’s the reason why the library can not be loaded.

We currently only support RHEL 6.2 and Ubuntu 12.04 Linux. I would suggest for you to find out whether Scientific Linux 6.3 you are using is compatible (or has compilers/libraries compatible) with the defaults on these two distributions.

Alright, I will try to setup glib on SL or test it with RHEL on a different machine.
Thanks for you help!