Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

HPCC compilation issues

dgza
Beginner
429 Views
So I built hpcc with atlas and now I'm trying to use MKL but I'm getting loads of errors when compiling it.

I followed this guide http://software.intel.com/en-us/articles/performance-tools-for-software-developers-use-of-intel-mkl-in-hpcc-benchmark/ and this is my Make file:

TOPdir = ../../..
INCdir = $(TOPdir)/include
BINdir = $(TOPdir)/bin/$(ARCH)
LIBdir = $(TOPdir)/lib/$(ARCH)
#
HPLlib = $(LIBdir)/libhpl.a
#
# ----------------------------------------------------------------------
# - Message Passing library (MPI) --------------------------------------
# ----------------------------------------------------------------------
# MPinc tells the C compiler where to find the Message Passing library
# header files, MPlib is defined to be the name of the library to be
# used. The variable MPdir is only used for defining MPinc and MPlib.
#
MPdir = /usr/bin/mpi
#MPinc = -I$(MPdir)/include
MPlib = /usr/lib64/mpich2/lib/libmpich.a
#
# ----------------------------------------------------------------------
# - Linear Algebra library (BLAS or VSIPL) -----------------------------
# ----------------------------------------------------------------------

#
LAdir = /opt/intel/mkl/lib/intel64
LAinc = /opt/intel/mkl/include
LAlib = -Wl,--start-group $(LAdir)/libfftw2x_cdft_DOUBLE.a $(LAdir)/libfftw2xc_gnu.a $(LAdir)/libmkl_intel_lp64.a $(LAdir)/libmkl_intel_thread.a $(LAdir)/libmkl_core.a $(LAdir)/libmkl_blacs_intelmpi_lp64.a $(LAdir)/libmkl_cdft_core.a -Wl,--end-group -lpthread -lm

F2CDEFS =
#
# ----------------------------------------------------------------------
# - HPL includes / libraries / specifics -------------------------------
# ----------------------------------------------------------------------
#
HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) -I$(LAinc) $(MPinc)
HPL_LIBS = $(HPLlib) $(LAlib) $(MPlib)
#
# - Compile time options -----------------------------------------------
#
HPL_OPTS = -DHPL_CALL_CBLAS
#
# ----------------------------------------------------------------------
#
HPL_DEFS = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)
#
# ----------------------------------------------------------------------
# - Compilers / linkers - Optimization flags ---------------------------
# ----------------------------------------------------------------------
#
CC = /usr/bin/mpicc
CCNOOPT = $(HPL_DEFS)
#CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops
CCFLAGS = $(HPL_DEFS) -fomit-frame-pointer -O3 -funroll-loops -DUSING_FFTW -DMKL_INT=long -DLONG_IS_64BITS -I/opt/intel/mkl/include/fftw
#
# On some platforms, it is necessary to use the Fortran linker to find
# the Fortran internals used in the BLAS library.
#
LINKER = /usr/bin/mpicc
LINKFLAGS = $(CCFLAGS)
#

Error here:

/opt/intel/mkl/lib/intel64/libmkl_intel_thread.a(bless_node_omp.o): In function `ttl_parallel_team':
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0xae): undefined reference to `__kmpc_global_thread_num'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0xc0): undefined reference to `__kmpc_ok_to_fork'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0xdb): undefined reference to `__kmpc_push_num_threads'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0x108): undefined reference to `__kmpc_fork_call'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0x120): undefined reference to `__kmpc_serialized_parallel'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0x156): undefined reference to `__kmpc_end_serialized_parallel'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0x1e0): undefined reference to `omp_get_thread_num'
../../../../dft/kernel/0ref/bless_node_omp.c:(.text+0x1e8): undefined reference to `omp_get_num_threads'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.a(dtrsm_drv.o): In function `mkl_blas_dtrsm':
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x296): undefined reference to `__kmpc_global_thread_num'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x2a8): undefined reference to `__kmpc_ok_to_fork'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x2c7): undefined reference to `__kmpc_push_num_threads'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x368): undefined reference to `__kmpc_fork_call'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x386): undefined reference to `__kmpc_serialized_parallel'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x437): undefined reference to `__kmpc_end_serialized_parallel'
../../../../blas/thread/32e/level3/dtrsm.c:(.text+0x624): undefined reference to `omp_get_num_threads'

any ideas?

TIA
0 Kudos
4 Replies
SergeyKostrov
Valued Contributor II
429 Views
You have theselinkererrors because in your Make file Intelruntime libraries, like 'libiomp5m*.a' etc, are not included.

Best regards,
Sergey
0 Kudos
Vladimir_Petrov__Int
New Contributor III
429 Views
Hello,

Please use this tool to find out the link (and compile) line for your configuration:
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
.
Here are a couple of hints you may find useful.
Decide which compiler and OpenMP library you are going to use (this will take care of the undefined references).
Decide which MPI you are going to use (this will define the correct blacs library to use). In case it is Intel MPI, then make sure you use the mpiicc wrapper instead of mpicc.

Best regards,
Vladimir
0 Kudos
TimP
Honored Contributor III
429 Views
If you are using Intel compilers, via a correctly configured mpi wrapper, the option -openmp in the link step will take care of the OpenMP functions; otherwise you will need to observe the recommendations of the link advisor in that respect, as well as in choice of MKL libraries.
0 Kudos
dgza
Beginner
429 Views
That tool did the trick, thanks.

Annoyingly, I had seen it a few weeks ago, but complitely forgot about it.
0 Kudos
Reply