A question on UMFPACK

150 views
Skip to first unread message

Louis

unread,
Sep 24, 2009, 12:34:55 AM9/24/09
to matrixprogramming
Hi everyone,

Does anyone have used UMFPACK, which can solve linear sparse systems?

My question is, how to link my program with the libraries(UMFPACK/Lib/
libumfpack.a and AMD/Lib/libamd.a), and tell my compiler to look for
include files in UMFPACK/Include and AMD/Include? Technically, I don't
know what command I should use within gcc in Linux. I know that if I
use LAPACK, I should use the command
gcc *.c -llapack
But the UMFPACK libraries/include files are not in the main library
folder/include folder, so I'm not sure what command I should type in
the terminal. Would you please give me some help?

Thank you!

Louis

Evgenii Rudnyi

unread,
Sep 24, 2009, 2:38:13 PM9/24/09
to matrixpr...@googlegroups.com
> Does anyone have used UMFPACK, which can solve linear sparse systems?

Yes, I do.

> My question is, how to link my program with the libraries(UMFPACK/Lib/
> libumfpack.a and AMD/Lib/libamd.a), and tell my compiler to look for
> include files in UMFPACK/Include and AMD/Include? Technically, I don't
> know what command I should use within gcc in Linux. I know that if I
> use LAPACK, I should use the command
> gcc *.c -llapack
> But the UMFPACK libraries/include files are not in the main library
> folder/include folder, so I'm not sure what command I should type in
> the terminal. Would you please give me some help?

The flag -Idirname but basically it will work automatically if you use
make. You can find some instructions here

http://matrixprogramming.com/UMFPACK/

Alejandro A. Ortiz Bernardin

unread,
Sep 24, 2009, 3:05:04 PM9/24/09
to matrixpr...@googlegroups.com

>> The flag -Idirname but basically it will work automatically if you use
>> make. You can find some instructions here

>> http://matrixprogramming.com/UMFPACK/

This is not a question related to UMFPACK, but I want to use this
opportunity to ask the following about windows version of gcc. I am using
MinGW. In the piece of makefile below (which actually do nothing), why cd
$(SRCDIR) does not find the directory if I put ";" after (SRCDIR)? On the
contrary, if I remove the ";" it will find it.

SRCDIR = src
MAKE = mingw32-make

MeshFree++:
cd $(SRCDIR);

The problem is that I need the ";" since I have to execute another makefile
which will be inside SRCDIR.


Evgenii Rudnyi

unread,
Sep 25, 2009, 2:36:41 PM9/25/09
to matrixpr...@googlegroups.com
> This is not a question related to UMFPACK, but I want to use this
> opportunity to ask the following about windows version of gcc. I am using
> MinGW. In the piece of makefile below (which actually do nothing), why cd
> $(SRCDIR) does not find the directory if I put ";" after (SRCDIR)? On the
> contrary, if I remove the ";" it will find it.
>
> SRCDIR = src
> MAKE = mingw32-make
>
> MeshFree++:
> cd $(SRCDIR);
>
> The problem is that I need the ";" since I have to execute another makefile
> which will be inside SRCDIR.

Frankly speaking I do not know. Does it work on Linux? If you make a
sample makefile, I can try it under Cygwin. If it is working there then
you have to contact MinGW people.

Alejandro A. Ortiz Bernardin

unread,
Sep 25, 2009, 3:13:07 PM9/25/09
to matrixpr...@googlegroups.com

Yes, it works in Linux and Cygwin

Alejandro A. Ortiz Bernardin

unread,
Sep 25, 2009, 4:05:58 PM9/25/09
to matrixpr...@googlegroups.com

The problem is that ";" does not work in cmd.exe as supposed to do it.
Instead, using "&" will work ... kinda weird.

-a


Louis

unread,
Sep 27, 2009, 11:38:32 PM9/27/09
to matrixprogramming
I used this command in the terminal
gcc *.c -L/home/UMFPACK/Lib/libumfpack.a -L/home/AMD/Lib/libamd.a -I/
home/UMFPACK/Include -I/home/AMD/Include
but there were a lot of errors such as

In file included from 2.c:2:
/home/UMFPACK/Include/umfpack.h:31:22: error: UFconfig.h: No such file
or directory
In file included from /home/UMFPACK/Include/umfpack.h:48,
from 2.c:2:
/home/UMFPACK/Include/umfpack_symbolic.h:23: error: expected ‘=’, ‘,’,
‘;’, ‘asm’ or ‘__attribute__’ before ‘umfpack_dl_symbolic’

Is there anything wrong with the command?

Evgenii Rudnyi

unread,
Sep 28, 2009, 2:04:11 PM9/28/09
to matrixpr...@googlegroups.com
> I used this command in the terminal
> gcc *.c -L/home/UMFPACK/Lib/libumfpack.a -L/home/AMD/Lib/libamd.a -I/
> home/UMFPACK/Include -I/home/AMD/Include
> but there were a lot of errors such as
>
> In file included from 2.c:2:
> /home/UMFPACK/Include/umfpack.h:31:22: error: UFconfig.h: No such file
> or directory

Yes, you need this file and it should be in /home/UFconfig/. Please
check if this the case, and then add -I/home/UFconfig


> In file included from /home/UMFPACK/Include/umfpack.h:48,
> from 2.c:2:
> /home/UMFPACK/Include/umfpack_symbolic.h:23: error: expected ‘=’, ‘,’,
> ‘;’, ‘asm’ or ‘__attribute__’ before ‘umfpack_dl_symbolic’

If UFconfig.h not found, then it may cause problems. For simplicity I
have copied all the headers from UMFPACK to my include directory. This
are the files that I have there:

$ ls amd* umfpack* UF*
UFconfig.h umfpack_global.h
umfpack_report_triplet.h
amd.h umfpack_load_numeric.h
umfpack_report_vector.h
amd_internal.h umfpack_load_symbolic.h umfpack_save_numeric.h
umfpack.h umfpack_numeric.h
umfpack_save_symbolic.h
umfpack_col_to_triplet.h umfpack_qsymbolic.h umfpack_scale.h
umfpack_defaults.h umfpack_report_control.h umfpack_solve.h
umfpack_free_numeric.h umfpack_report_info.h umfpack_symbolic.h
umfpack_free_symbolic.h umfpack_report_matrix.h umfpack_tictoc.h
umfpack_get_determinant.h umfpack_report_numeric.h umfpack_timer.h
umfpack_get_lunz.h umfpack_report_perm.h umfpack_transpose.h
umfpack_get_numeric.h umfpack_report_status.h
umfpack_triplet_to_col.h
umfpack_get_symbolic.h umfpack_report_symbolic.h umfpack_wsolve.h

Otherwise you have to use -I with three directories for AMD, UMFPACK and
UFconfig.

Louis

unread,
Sep 29, 2009, 2:38:56 PM9/29/09
to matrixprogramming
Thank you. I added the full path in the makefiles for UFconfig.h and
it works.

Now another problem comes, do I have to claim the umfpack functions
before I use in my own code? Because when I compiled, there were
errors:

/tmp/ccCddSin.o: In function `main':
umfpack_simple.c:(.text+0x59): undefined reference to
`umfpack_di_symbolic'
umfpack_simple.c:(.text+0x91): undefined reference to
`umfpack_di_numeric'
umfpack_simple.c:(.text+0x9c): undefined reference to
`umfpack_di_free_symbolic'
umfpack_simple.c:(.text+0xe5): undefined reference to
`umfpack_di_solve'
umfpack_simple.c:(.text+0xf0): undefined reference to
`umfpack_di_free_numeric'
collect2: ld returned 1 exit status

If so, how should I claim in my code? Is it like
extern "C" void umfpack_di_symbolic_(int, int, const int, const int,
const double, void **, const double, double);
? (I tried this but it seems not right...)

Thanks,
Louis.

Evgenii Rudnyi

unread,
Sep 29, 2009, 3:59:12 PM9/29/09
to matrixpr...@googlegroups.com
> umfpack_simple.c:(.text+0xf0): undefined reference to
> `umfpack_di_free_numeric'
> collect2: ld returned 1 exit status
>
> If so, how should I claim in my code? Is it like
> extern "C" void umfpack_di_symbolic_(int, int, const int, const int,
> const double, void **, const double, double);
> ? (I tried this but it seems not right...)

The declaration of this function is in the UMFPACK headers, so you do
not have to do it in your program. You just include the umfpack header,
this should be enough.

The problem seems to be that you do not specify the libs correctly. It
should be something like this

gcc *.c -I... -L/home/UMFPACK/Lib -L/home/AMD/Lib/ -lamd -lumfpack

You may want to run this tutorial first

http://matrixprogramming.com/Tools/CompileLink.html

Louis

unread,
Sep 29, 2009, 4:48:00 PM9/29/09
to matrixprogramming
Following your instructions, yet changing gcc to g++, I've made the
program running. Thanks a lot! But do you know why gcc doesn't work
well in my Ubuntu system?

Evgenii Rudnyi

unread,
Sep 30, 2009, 1:34:08 PM9/30/09
to matrixpr...@googlegroups.com
> Following your instructions, yet changing gcc to g++, I've made the
> program running. Thanks a lot! But do you know why gcc doesn't work
> well in my Ubuntu system?

If your code is in C++, then you need to link with the standard C++ libs
and gcc does not do it by default. g++ on the other hand does. You can
use -v to see what a command is finally issued.

Reply all
Reply to author
Forward
0 new messages