Thread: library problem again!!!

  1. #1
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342

    library problem again!!!

    I have to link plenty of libraries here and its getting all messy:

    Here's a list of libraries that i have to link :
    1. fftw-3.1.1 at /compiler/fftw3.1.1
    2. fftw-2.1.5 at /compiler/fftw-2.1.5
    3. acml3.1.0 at /compiler/acml3.1.0

    acml3.1.0 uses pathcc and pathfortran , so that are to be linked
    to enable the threading I have to include libfftw_threads.a and libpthread.a too






    Code:
     
    
     mpicc fourier_pc.o -I/compiler/fftw-3.1.1/include -I/compiler/fftw-2.1.5/include -L/usr/lib -L/compiler/fftw-3.1.1/lib -L/compiler/fftw-2.1.5/lib -L/compiler/acml3.1.0/pathscale64/lib -L/compiler/pathscale/lib/2.4  -lfftw3
    -lacml -lacml_mv -lpathfortran -lfftw_threads -lpthread  -lm
    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
    /usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
    /usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
    /usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
    /usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
    fourier_pc.o(.text+0x3b): In function `main':
    : undefined reference to `fftw_init_threads'
    fourier_pc.o(.text+0x11b): In function `main':
    : undefined reference to `fftw_plan_with_nthreads'
    fourier_pc.o(.text+0x1f1): In function `main':
    : undefined reference to `fftw_cleanup_threads'
    collect2: ld returned 1 exit status
    not able to make out what

    [code]

    /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread

    [/code

    really means..

    pretty sure, those undefined references will go once the "libthread.a" is linked properly
    Last edited by kris.c; 07-12-2006 at 02:37 AM.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Are you using a 64-bit library on a 32-bit OS or vice versa?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    I have no idea.. I am working on a cluster..
    How do i find out?

  4. #4
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342

    slightly better ..still not good enough

    Some development :

    Code:
    
     my prog name is fourier_pc.c 
    1.  the location of fftw-3.1.1 is : /compiler/fftw-3.1.1 
                 the contents of the lib dir are :  libfftw3.a  libfftw3.la  pkgconfig 
                 the contents of the include  dir are :     fftw3.f  fftw3.h 
    
    2.the location of the threaded version of fftw-3.1.1 is  :  /compiler/fftw-3.1.1-dp-threads 
                      the contents of the lib dir are :   
       libfftw3l.a  libfftw3l.la  
       libfftw3l_threads.a         libfftw3l_threads.la                                                      
       pkgconfig 
    
                 the contents of the include  dir are :     fftw3.f  fftw3.h 
    
    
    3. the location of ACML  is   :     /compiler 
    
    THis is what i have done till noiw : 
    
    $>    pathcc -c -I/compiler/fftw-3.1.1/include  fourier_pc.c -L/compiler/fftw-3.1.1/lib -lfftw3 
    
    
    $>    gcc fourier_pc.o  -L/compiler/fftw-3.1.1/lib -L/compiler/fftw-3.1.1-dp-threads/lib -L/compiler/acml3.1.0/pathscale64/lib -L/compiler/pathscale/lib/2.4  -lpthread -lfftw3l_threads  -lfftw3 -lacml -lacml_mv -lpathfortran  -lm 
    
    and these are the error message si am getting : 
    fourier_pc.o(.text+0x38): In function `main': 
    : undefined reference to `fftw_init_threads' 
    fourier_pc.o(.text+0xb2): In function `main': 
    : undefined reference to `fftw_plan_with_nthreads' 
    fourier_pc.o(.text+0x189): In function `main': 
    : undefined reference to `fftw_cleanup_threads' 
    collect2: ld returned 1 exit status

    I have tried all kinds of combinations with -lpthread -lfftw3l_threads -lfftw3 ...I still get the same set of messages..
    I need help badly, with this

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > : undefined reference to `fftw_init_threads'
    Are you sure you spelled these correctly?

    You can see what symbols a library exports by doing something like
    nm /compiler/fftw-3.1.1-dp-threads/lib/libfftw3l_threads.a

    Do the symbols you're looking for exist in that library?

    Are there no readme / howto / FAQ entries describing the command line for what you're trying?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    > Are you sure you spelled these correctly?
    I am copy pasting the messages..

    well, anyway .. today mor my project guide told me more about the version fftw-2.1.5 that supports mpi . Looking at that now, its a neat package that combines the best of both fftw and mpi..
    I think i can take it from here...

    OK, I need one HUGE doubt here..
    What is the difference between implementing FFTW transform using multi threading and using MPI?
    Is multi threading allowed for systems with distributed memory or is it only for shared memory devices?
    If it is allowed for distributed systems how can the threads communicate between each other..

    The mistake i was commiting (like an idiot) was splitting up the input array into " p " partitions if i am working with " p " processors. And issusing one partition to one processor. Naturally this gave me the wrong result . An 1000 -point fourier transform is different from a 250 point transform ( if the original size is 1000 and i am using 4 processors.. If I have to follow the same method of partitioning , any ideas how to do it with multi-threading?

    thanks
    Last edited by kris.c; 07-13-2006 at 02:56 AM.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > > Are you sure you spelled these correctly?
    > I am copy pasting the messages..
    It's not that I'm worried about.
    Writing fftw_init_threads in the code and the library defines fftwInitThreads is one reason why the error message might appear.

    MPI and/or threading is only going to do you any good if you have more than one physical processor to hand. Otherwise you're just wasting time copying stuff around and switching contexts (all on the same processor).

    In addition, the cost of MPI has to be small compared to the work to be performed. There's little point in spending a second transferring the work if it only takes half a second to do the work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    >MPI and/or threading is only going to do you any good if you have more than one physical processor to hand.
    I have mentioned earlier , I am working on a cluster..

    >In addition, the cost of MPI has to be small compared to the work to be performed. There's little point in spending a second transferring the work if it only takes half a second to do the work.

    The job that i have been assigned as a part of my projct is to get the parallel fftw working.. The group where i am working have tons of data that is being gathered day in and day out thru a radio telescope to be processed
    Please answer my question about multi-threading and MPI
    Last edited by kris.c; 07-13-2006 at 06:39 AM.

  9. #9
    Eager young mind
    Join Date
    Jun 2006
    Posts
    342
    REgarding the error messages :
    .> Writing fftw_init_threads in the code and the library defines fftwInitThreads is one reason why the error message might appear.

    Cant agree with u more ..

    the lib file that supports multi-threading is " libfftw3l_threads.a "
    and its location is : " /compiler/fftw-3.1.1-dp-threads/bin "

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. undefined Reference when linking a library
    By steve1_rm in forum C Programming
    Replies: 7
    Last Post: 03-12-2008, 05:34 PM
  2. Templates from DLL or static library problem
    By mikahell in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2008, 01:49 AM
  3. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  4. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  5. Problem With WinPcap library
    By DrMario in forum C Programming
    Replies: 0
    Last Post: 03-26-2005, 11:26 AM