Problem with -lifcore

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Tue Jun 16, 2015 1:45 pm

Ok here is the module. iIt' s in the Library-folder :

Code: Select all

module Mod_MiBliV
  use Mod_Functions
  use omp_lib
  implicit none
  !
  type SNM
    ...
    procedure :: SolveSSEigenFastGraka
    ...
    include "SolveSSEigenFastGraka.f90" !\include SolveSSEigenFastGraka.f90
    ...
end module
the routine in SolveSSEigenFastGraka.f90:

Code: Select all

subroutine SolveSSEigenFastGraka(this)
!
  use magma

  implicit none

!-------- declarations
  integer :: i,j
  complex*16,   allocatable, dimension(:,:) :: h_A, h_B
  integer*8 :: d_A, d_B
  integer :: M = 1000
  integer :: N = 1000
  integer :: lda,info
  integer, dimension(:),allocatable :: ipiv
  integer*8 :: d_ipiv
  real(kind=8)                  :: flops, t, tstart, tend
  class(SNM) :: this        !< object handler

  lda = N



!--------- initialize MAGMA
  !call cublas_init()
  call magmaf_init();

!---------- allocate CPU memory
  allocate(h_A(N,N))
  allocate(h_B(M,N))
  allocate(ipiv(n))

!---------- allocate GPU memory
  call cublas_alloc(N*N, sizeof_complex, d_A)
  !call cublas_alloc(M*N, sizeof_double, d_A)
  !call magmaf_zmalloc( dA, M*N );
  !magma_zmalloc( &dX, lddx*nrhs );

!---------- Initializa the matrix
  do i=1,M
    do j=1,N
      h_A(i,j) = i+j
      h_B(i,j) = i+j
    end do
  end do

  call cublas_set_matrix (N, N, sizeof_complex, h_A, M, d_A,lda)
  !call magma_zset_matrix( lda, n, A,  lda, dA, lda );

  call magma_wtime_f(tstart)
  call magmaf_zgetrf(n, n, h_A, lda, ipiv, info)
  call magma_wtime_f(tend)

  write(*,*) tend - tstart

  call magma_wtime_f(tstart)
  !call zgetrf(n, n, h_A, lda, ipiv, info)
  call magmaf_cgetrf_gpu(n, n, d_A, lda, ipiv, info)
  call magma_wtime_f(tend)
  !
  write(*,*) tend - tstart
end subroutine solveSSEigenFastGraka
the makefile for the module:

Code: Select all

#
# makefile for library generation
#
#==========#
# Compiler
#==========#
#
FC = gfortran-4.8
CC = gcc

# Paths where MAGMA and CUDA are installed
LAPACKDIR = /usr/lib
MAGMADIR     = /home/tobi/Programme/magma-1.6.2
CUDADIR      = /usr/local/cuda
ATLASDIR  = /usr/local/atlas

LIBDIR    = -L$(CUDADIR)/lib64 \
            -L$(LAPACKDIR) \
            -L$(MAGMADIR)/lib \
            -L$(ATLASDIR)/lib

CC            = gcc
FORT          = gfortran-4.8
LD            = gcc
CFLAGS        = -Wall
LDFLAGS       = -Wall
F90FLAGS      = -shared -fPIC -frecord-marker=4 -O2
F90FLAGS2     = -frecord-marker=4 -O2

MAGMA_CFLAGS   := -DADD_ -I$(MAGMADIR)/include -I$(CUDADIR)/include
MAGMA_F90FLAGS := -I$(MAGMADIR)/include -Dmagma_devptr_t="integer(kind=8)"

MAGMA_LIBS   := $(LIBDIR) \
                -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp

#
#=======================================#
# Path to Fortran-Modules (HeaderFiles)
#=======================================#
#
MODPATH= -J ../01_Modules/
#
#===========================#
# Flags for Shared library
#===========================#
#
LDFLAG1 = ~/Programme/LibSparseMatrix/00_Source/libSparseMatrix.so
LDFLAG1 += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so
LDFLAG1 += /usr/lib/liblapack.so
#CFLAG1  = -shared -fPIC $(CFLAG) 
#
#===========================#
# Flags for Static library
#===========================#
#
LDFLAG2 = ~/Programme/LibSparseMatrix/00_Source/libSparseMatrix.a
CFLAG2  = $(CFLAG)
#
#all: libMiBliV.so libMiBliV.a
all: libMiBliV.so

Mod_MiBliV.o: Mod_MiBliV.f90
  $(FC) $(F90FLAGS2) $(MAGMA_F90FLAGS)  -c -o  $@ $^ $(MODPATH)

fortran.o: $(CUDADIR)/src/fortran.c
  $(CC) $(CFLAGS) $(MAGMA_CFLAGS) -DCUBLAS_GFORTRAN -c -o $@ $<

libMiBliV.so:
  $(FORT) $(F90FLAGS) $(MAGMA_F90FLAGS)  -o $@ Mod_MiBliV.f90 $(LDFLAG1) $(MODPATH)


#libMiBliV.so: 
# $(FC) $(CFLAG1) $(MAGMA_F90FLAGS) -o $@ Mod_MiBliV.f90 $(LDFLAG1) $(MODPATH)

#libMiBliV: Mod_MiBliV.o fortran.o
# $(FC) $(LDFLAGS) -o $@ $^ $(MAGMA_LIBS)  $(LDFLAG1) $(MODPATH)

clean:
  rm libMiBliV.so libMiBliV.a Mod_MiBliV.o
In my source folder i want to use this and other modules.

Code: Select all

program MiBliV
  use Mod_MiBliV
  use omp_lib
  !
  implicit none
  !
  type(SNM),intent(inout) :: ROM
  
  ! read ROM data
  call ROM%readDat('R1')
  call ROM%SolveSSEigenFastGraka
end program MiBliV
my makefile in the source folder:

Code: Select all

# DEBUG -compiling
FC = gfortran-4.8
CC = gcc

#
#
# Paths where MAGMA and CUDA are installed
LAPACKDIR = /usr/lib
MAGMADIR     = /home/tobi/Programme/magma-1.6.2
CUDADIR      = /usr/local/cuda
ATLASDIR  = /usr/local/atlas

LIBDIR    = -L$(CUDADIR)/lib64 \
            -L$(LAPACKDIR) \
            -L$(MAGMADIR)/lib \
            -L$(ATLASDIR)/lib

#CFLAGS = -frecord-marker=4 -fbounds-check -O0 -g
#CFLAGS = -frecord-marker=4 -O2 -static
# normal (faster)
CC            = gcc
FORT          = gfortran-4.8
LD            = gcc
CFLAGS        = -Wall
LDFLAGS       = -Wall
F90FLAGS      = -frecord-marker=4 -O2

MAGMA_CFLAGS   := -DADD_ -I$(MAGMADIR)/include -I$(CUDADIR)/include
MAGMA_F90FLAGS := -I$(MAGMADIR)/include -Dmagma_devptr_t="integer(kind=8)"

MAGMA_LIBS   := $(LIBDIR) \
                -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp

#================================
# Required third party libraries:
# (a) LAPACK, vers.> 3.0
#================================
#
#=================
# shared library
#=================
LDFLAG = /home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so
#LDFLAG += /home/tobi/Programme/Function/Functions_Module/libFuncs.so
LDFLAG += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so
LDFLAG += /usr/lib/liblapack.so
#LDFLAG += -L/usr/local/cuda/lib64 
#LDFLAG += -L/home/tobi/Programme/magma-1.6.2
#LDFLAG += -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp
MODPATH= -J ../01_Modules/

#===================
# static libraries
#===================
#LDFLAG =  ../00_Library/libMiBliV.a
#LDFLAG += /home/tobi/Programme/LibSparseMatrix/00_Source/libSparseMatrix.a
#LDFLAG += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.a 
#LDFLAG += /home/giersch/Programme/Functions/08_V_1.1.1_Thomas/libFuncs.a
#LDFLAG += /usr/lib/liblapack.a
#LDFLAG += liblapack.a
#LDFLAG += /usr/lib/libblas.a 
#MODPATH= -J ../01_Modules/
#OptimFourrier.f90

#nvcc -c -DCUBLAS_GFORTRAN -I/usr/local/cuda/include -I/usr/local/cuda/src -o fortran.o /usr/local/cuda/src/fortran.c

all: MiBliV MiBliV2

%.o: %.f90
  $(FC) $(F90FLAGS) $(MAGMA_F90FLAGS)  -c -o $@ $^ $(MODPATH)

fortran.o: $(CUDADIR)/src/fortran.c
  $(CC) $(CFLAGS) $(MAGMA_CFLAGS) -DCUBLAS_GFORTRAN -c -o $@ $<

MiBliV: MiBliV.o\
 Menu.o\
 Menu_Alternative.o\
 Menu_Alternative_Paral.o\
 Menu2.o\
 Optim.o\
 OptimGlob.o\
 Menu_Modify.o\
 Init.o\
 fortran.o
  $(FC) $(LDFLAGS) $(MAGMA_F90FLAGS) -o $@ $^ $(MAGMA_LIBS) $(LDFLAG)

MiBliV2: MiBliV2.o\
 Menu.o\
 Menu_Alternative.o\
 Menu_Alternative_Paral.o\
 Menu2.o\
 Optim.o\
 OptimGlob.o\
 Menu_Modify.o\
 Init.o\
 fortran.o
  $(FC) $(LDFLAGS) $(MAGMA_F90FLAGS) -o $@ $^  $(MAGMA_LIBS) $(LDFLAG) 

clean:
  rm *.o
  rm MiBliV
  rm -r "doc/"
]

echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Tue Jun 16, 2015 1:48 pm

Ok here is the module. iIt' s in the Library-folder :

Code: Select all

module Mod_MiBliV
  use Mod_Functions
  use omp_lib
  implicit none
  !
  type SNM
    ...
    procedure :: SolveSSEigenFastGraka
    ...
    include "SolveSSEigenFastGraka.f90" !\include SolveSSEigenFastGraka.f90
    ...
end module
the routine in SolveSSEigenFastGraka.f90:

Code: Select all

subroutine SolveSSEigenFastGraka(this)
!
  use magma

  implicit none

!-------- declarations
  integer :: i,j
  complex*16,   allocatable, dimension(:,:) :: h_A, h_B
  integer*8 :: d_A, d_B
  integer :: M = 1000
  integer :: N = 1000
  integer :: lda,info
  integer, dimension(:),allocatable :: ipiv
  integer*8 :: d_ipiv
  real(kind=8)                  :: flops, t, tstart, tend
  class(SNM) :: this        !< object handler

  lda = N



!--------- initialize MAGMA
  !call cublas_init()
  call magmaf_init();

!---------- allocate CPU memory
  allocate(h_A(N,N))
  allocate(h_B(M,N))
  allocate(ipiv(n))

!---------- allocate GPU memory
  call cublas_alloc(N*N, sizeof_complex, d_A)
  !call cublas_alloc(M*N, sizeof_double, d_A)
  !call magmaf_zmalloc( dA, M*N );
  !magma_zmalloc( &dX, lddx*nrhs );

!---------- Initializa the matrix
  do i=1,M
    do j=1,N
      h_A(i,j) = i+j
      h_B(i,j) = i+j
    end do
  end do

  call cublas_set_matrix (N, N, sizeof_complex, h_A, M, d_A,lda)
  !call magma_zset_matrix( lda, n, A,  lda, dA, lda );

  call magma_wtime_f(tstart)
  call magmaf_zgetrf(n, n, h_A, lda, ipiv, info)
  call magma_wtime_f(tend)

  write(*,*) tend - tstart

  call magma_wtime_f(tstart)
  !call zgetrf(n, n, h_A, lda, ipiv, info)
  call magmaf_cgetrf_gpu(n, n, d_A, lda, ipiv, info)
  call magma_wtime_f(tend)
  !
  write(*,*) tend - tstart
end subroutine solveSSEigenFastGraka
the makefile for the module:

Code: Select all

#
# makefile for library generation
#
#==========#
# Compiler
#==========#
#
FC = gfortran-4.8
CC = gcc

# Paths where MAGMA and CUDA are installed
LAPACKDIR = /usr/lib
MAGMADIR     = /home/tobi/Programme/magma-1.6.2
CUDADIR      = /usr/local/cuda
ATLASDIR  = /usr/local/atlas

LIBDIR    = -L$(CUDADIR)/lib64 \
            -L$(LAPACKDIR) \
            -L$(MAGMADIR)/lib \
            -L$(ATLASDIR)/lib

CC            = gcc
FORT          = gfortran-4.8
LD            = gcc
CFLAGS        = -Wall
LDFLAGS       = -Wall
F90FLAGS      = -shared -fPIC -frecord-marker=4 -O2
F90FLAGS2     = -frecord-marker=4 -O2

MAGMA_CFLAGS   := -DADD_ -I$(MAGMADIR)/include -I$(CUDADIR)/include
MAGMA_F90FLAGS := -I$(MAGMADIR)/include -Dmagma_devptr_t="integer(kind=8)"

MAGMA_LIBS   := $(LIBDIR) \
                -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp

#
#=======================================#
# Path to Fortran-Modules (HeaderFiles)
#=======================================#
#
MODPATH= -J ../01_Modules/
#
#===========================#
# Flags for Shared library
#===========================#
#
LDFLAG1 = ~/Programme/LibSparseMatrix/00_Source/libSparseMatrix.so
LDFLAG1 += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so
LDFLAG1 += /usr/lib/liblapack.so
#CFLAG1  = -shared -fPIC $(CFLAG) 
#
#===========================#
# Flags for Static library
#===========================#
#
LDFLAG2 = ~/Programme/LibSparseMatrix/00_Source/libSparseMatrix.a
CFLAG2  = $(CFLAG)
#
#all: libMiBliV.so libMiBliV.a
all: libMiBliV.so

Mod_MiBliV.o: Mod_MiBliV.f90
  $(FC) $(F90FLAGS2) $(MAGMA_F90FLAGS)  -c -o  $@ $^ $(MODPATH)

fortran.o: $(CUDADIR)/src/fortran.c
  $(CC) $(CFLAGS) $(MAGMA_CFLAGS) -DCUBLAS_GFORTRAN -c -o $@ $<

libMiBliV.so:
  $(FORT) $(F90FLAGS) $(MAGMA_F90FLAGS)  -o $@ Mod_MiBliV.f90 $(LDFLAG1) $(MODPATH)


#libMiBliV.so: 
# $(FC) $(CFLAG1) $(MAGMA_F90FLAGS) -o $@ Mod_MiBliV.f90 $(LDFLAG1) $(MODPATH)

#libMiBliV: Mod_MiBliV.o fortran.o
# $(FC) $(LDFLAGS) -o $@ $^ $(MAGMA_LIBS)  $(LDFLAG1) $(MODPATH)

clean:
  rm libMiBliV.so libMiBliV.a Mod_MiBliV.o
In my source folder i want to use this and other modules.

Code: Select all

program MiBliV
  use Mod_MiBliV
  use omp_lib
  !
  implicit none
  !
  type(SNM),intent(inout) :: ROM
  
  ! read ROM data
  call ROM%readDat('R1')
  call ROM%SolveSSEigenFastGraka
end program MiBliV
my makefile in the source folder:

Code: Select all

# DEBUG -compiling
FC = gfortran-4.8
CC = gcc

#
#
# Paths where MAGMA and CUDA are installed
LAPACKDIR = /usr/lib
MAGMADIR     = /home/tobi/Programme/magma-1.6.2
CUDADIR      = /usr/local/cuda
ATLASDIR  = /usr/local/atlas

LIBDIR    = -L$(CUDADIR)/lib64 \
            -L$(LAPACKDIR) \
            -L$(MAGMADIR)/lib \
            -L$(ATLASDIR)/lib

#CFLAGS = -frecord-marker=4 -fbounds-check -O0 -g
#CFLAGS = -frecord-marker=4 -O2 -static
# normal (faster)
CC            = gcc
FORT          = gfortran-4.8
LD            = gcc
CFLAGS        = -Wall
LDFLAGS       = -Wall
F90FLAGS      = -frecord-marker=4 -O2

MAGMA_CFLAGS   := -DADD_ -I$(MAGMADIR)/include -I$(CUDADIR)/include
MAGMA_F90FLAGS := -I$(MAGMADIR)/include -Dmagma_devptr_t="integer(kind=8)"

MAGMA_LIBS   := $(LIBDIR) \
                -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp

#================================
# Required third party libraries:
# (a) LAPACK, vers.> 3.0
#================================
#
#=================
# shared library
#=================
LDFLAG = /home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so
#LDFLAG += /home/tobi/Programme/Function/Functions_Module/libFuncs.so
LDFLAG += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so
LDFLAG += /usr/lib/liblapack.so
#LDFLAG += -L/usr/local/cuda/lib64 
#LDFLAG += -L/home/tobi/Programme/magma-1.6.2
#LDFLAG += -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp
MODPATH= -J ../01_Modules/

#===================
# static libraries
#===================
#LDFLAG =  ../00_Library/libMiBliV.a
#LDFLAG += /home/tobi/Programme/LibSparseMatrix/00_Source/libSparseMatrix.a
#LDFLAG += /home/tobi/Programme/Function/FunctionsDevel/libFuncs.a 
#LDFLAG += /home/giersch/Programme/Functions/08_V_1.1.1_Thomas/libFuncs.a
#LDFLAG += /usr/lib/liblapack.a
#LDFLAG += liblapack.a
#LDFLAG += /usr/lib/libblas.a 
#MODPATH= -J ../01_Modules/
#OptimFourrier.f90

#nvcc -c -DCUBLAS_GFORTRAN -I/usr/local/cuda/include -I/usr/local/cuda/src -o fortran.o /usr/local/cuda/src/fortran.c

all: MiBliV MiBliV2

%.o: %.f90
  $(FC) $(F90FLAGS) $(MAGMA_F90FLAGS)  -c -o $@ $^ $(MODPATH)

fortran.o: $(CUDADIR)/src/fortran.c
  $(CC) $(CFLAGS) $(MAGMA_CFLAGS) -DCUBLAS_GFORTRAN -c -o $@ $<

MiBliV: MiBliV.o\
 Menu.o\
 Menu_Alternative.o\
 Menu_Alternative_Paral.o\
 Menu2.o\
 Optim.o\
 OptimGlob.o\
 Menu_Modify.o\
 Init.o\
 fortran.o
  $(FC) $(LDFLAGS) $(MAGMA_F90FLAGS) -o $@ $^ $(MAGMA_LIBS) $(LDFLAG)

MiBliV2: MiBliV2.o\
 Menu.o\
 Menu_Alternative.o\
 Menu_Alternative_Paral.o\
 Menu2.o\
 Optim.o\
 OptimGlob.o\
 Menu_Modify.o\
 Init.o\
 fortran.o
  $(FC) $(LDFLAGS) $(MAGMA_F90FLAGS) -o $@ $^  $(MAGMA_LIBS) $(LDFLAG) 

clean:
  rm *.o
  rm MiBliV
  rm -r "doc/"
]

If I comment out the magma commands in SolveSSEigenFastGraka.f90, it works.

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Problem with -lifcore

Post by mgates3 » Tue Jun 16, 2015 2:09 pm

What I mean is that this:

/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magma_wtime_f_'

is the output of some program. What program and with what arguments?

For instance, here's an error on my machine. (In this case I intentionally mis-compiled a library to force an error.) What we need is that first few lines showing what was run (in this case, make invoked g++ -fPIC ...).

Code: Select all

mint sparse-iter/testing> make -j1
/usr/bin/g++ -fPIC               -Wl,-rpath,../../lib  testing_zblas.o -o testing_zblas \
	../../testing/libtest.a -L../../lib -lmagma_sparse -lmagma \
	-L/usr/local/cuda-5.5/lib -L/opt/intel/mkl/lib -L/opt/intel/composerxe/lib \
	-lmkl_intel -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -lm -lcublas -lcudart -lstdc++ -lm -lgfortran -lcusparse 
Undefined symbols for architecture x86_64:
  "_magma_dznrm2", referenced from:
      _main in testing_zblas.o
  "_magma_finalize", referenced from:
      _main in testing_zblas.o
  "_magma_getdevices", referenced from:
      _parse_opts in libtest.a(magma_util.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [testing_zblas] Error 1

echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Tue Jun 16, 2015 2:25 pm

can deleted
Last edited by echse on Tue Jun 16, 2015 2:27 pm, edited 1 time in total.

echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Tue Jun 16, 2015 2:26 pm

Ah ok:
in my lib folder:

Code: Select all

tobi@tobi-rechner-ubuntu:~/Programme/04_MiBliV_OBJ/00_Library$ make
gfortran-4.8 -shared -fPIC -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -o libMiBliV.so Mod_MiBliV.f90 ~/Programme/LibSparseMatrix/00_Source/libSparseMatrix.so  /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so /usr/lib/liblapack.so -J ../01_Modules/
in my source folder:

Code: Select all

tobi@tobi-rechner-ubuntu:~/Programme/04_MiBliV_OBJ/00_Library$ make
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o MiBliV.o MiBliV.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Menu.o Menu.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Menu_Alternative.o Menu_Alternative.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Menu_Alternative_Paral.o Menu_Alternative_Paral.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Menu2.o Menu2.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Optim.o Optim.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o OptimGlob.o OptimGlob.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Menu_Modify.o Menu_Modify.f90 -J ../01_Modules/ 
gfortran-4.8 -frecord-marker=4 -O2 -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)"  -c -o Init.o Init.f90 -J ../01_Modules/ 
gcc -Wall -DADD_ -I/home/tobi/Programme/magma-1.6.2/include -I/usr/local/cuda/include -DCUBLAS_GFORTRAN -c -o fortran.o /usr/local/cuda/src/fortran.c
gfortran-4.8 -Wall -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)" -o MiBliV MiBliV.o Menu.o Menu_Alternative.o Menu_Alternative_Paral.o Menu2.o Optim.o OptimGlob.o Menu_Modify.o Init.o fortran.o -L/usr/local/cuda/lib64 -L/usr/lib -L/home/tobi/Programme/magma-1.6.2/lib -L/usr/local/atlas/lib -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp /home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so  /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so /usr/lib/liblapack.so 
/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magma_wtime_f_'
/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magmaf_init_'
/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magmaf_finalize_'
/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magmaf_cgetrf_gpu_'
/home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so: Nicht definierter Verweis auf `magmaf_zgetrf_'
collect2: error: ld returned 1 exit status
make: *** [MiBliV] Fehler 1

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Problem with -lifcore

Post by mgates3 » Tue Jun 16, 2015 3:04 pm

Looks like order of libraries again. libMiBliV.so and libFuncs.so, if they use MAGMA, must be before MAGMA.

gfortran-4.8 -Wall -I/home/tobi/Programme/magma-1.6.2/include -Dmagma_devptr_t="integer(kind=8)" -o MiBliV MiBliV.o Menu.o Menu_Alternative.o Menu_Alternative_Paral.o Menu2.o Optim.o OptimGlob.o Menu_Modify.o Init.o fortran.o -L/usr/local/cuda/lib64 -L/usr/lib -L/home/tobi/Programme/magma-1.6.2/lib -L/usr/local/atlas/lib -lmagma -lcublas -llapack -lf77blas -lcblas -latlas -lcublas -lcudart -lstdc++ -lm -lgfortran -fopenmp /home/tobi/Programme/04_MiBliV_OBJ/00_Library/libMiBliV.so /home/tobi/Programme/Function/FunctionsDevel/libFuncs.so /usr/lib/liblapack.so

Also, since you have -llapack, you don't need /usr/lib/liblapack.so, though it probably doesn't hurt.

-mark

echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Wed Jun 17, 2015 1:26 am

That makes sense, now it works. Thanks a lot. :)

Tobi

echse
Posts: 15
Joined: Thu May 28, 2015 9:59 am

Re: Problem with -lifcore

Post by echse » Tue Jun 23, 2015 1:36 am

Hi,

is there a possibility to use a parallel loop with open mp like

Code: Select all

call omp_set_num_threads( threads )
!
  !$omp parallel private( i ) 
    !$omp do
      do i=1,100
        act_thread = omp_get_thread_num()+1
!       
        write(*,*) i
!        write(*,*) 'hi',act_thread
!        !ROM = ROM_tot(act_thread)
!        if (act_thread == 1) then
!          call ROM1%solveFR(16)
!        elseif (act_thread == 2) then
!          call ROM2%solveFR(16)
!        elseif (act_thread == 3) then
!          call ROM3%solveFR(16)
!        end if
!        write(*,*) ROM%ForceNf,ROM%FnMaxAmpl(1,:)
      end do
The problem is that this loop runs sequentially.

Tobi

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Problem with -lifcore

Post by mgates3 » Thu Jul 09, 2015 12:09 pm

It runs in parallel. Please include complete examples that can be compiled, with actual output and what you expected.

Code: Select all

program main
    use omp_lib
    implicit none
    
    integer :: threads
    integer :: i, act_thread, nthread
    
    threads = 3
    
    call omp_set_num_threads( threads )
    
    !$omp parallel private( i, act_thread ) 
        nthread = omp_get_num_threads()  ! must be inside parallel section
        
        !$omp do
        do i=1,100
            act_thread = omp_get_thread_num()+1
            write(*,*) i, act_thread, nthread
        end do
        !$omp end do
    !$omp end parallel
end
Output:

Code: Select all

gfortran -fopenmp -o omp omp.f90
./omp
           1           1           3
          35           2           3
          68           3           3
           2           1           3
          36           2           3
          69           3           3
           3           1           3
          37           2           3

Post Reply