Skip to content

Commit

Permalink
Added parameter MKLOPT
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuya-goto committed Apr 19, 2023
1 parent 5137458 commit 53707ad
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 50 deletions.
111 changes: 61 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -465,68 +465,79 @@ ifeq ($(BLASLAPACK), MKL)
ifeq ("$(MKLROOT)", "")
$(error MKLROOT not set; please make sure the environment variables are correctly set)
endif
# BLAS
ifeq ("$(shell uname)", "Linux")
MKL_LIBDIR := ${MKLROOT}/lib/intel64
ifeq ($(COMPILER), INTEL)
BLASLIB = -Wl,--start-group \
${MKL_LIBDIR}/libmkl_intel_lp64.a \
${MKL_LIBDIR}/libmkl_intel_thread.a \
${MKL_LIBDIR}/libmkl_core.a \
-Wl,--end-group -liomp5
MKLOPT ?= NONE
ifneq ($(MKLOPT), NONE)
ifneq ($(COMPILER), INTEL)
$(error MKLOPT can be specified only when COMPILER==INTEL)
endif
ifeq ($(COMPILER), GCC)
BLASLIB = -Wl,--start-group \
${MKL_LIBDIR}/libmkl_gf_lp64.a \
${MKL_LIBDIR}/libmkl_gnu_thread.a \
${MKL_LIBDIR}/libmkl_core.a \
-Wl,--end-group -lgomp -ldl
endif
# LAPACK
LAPACKLIB = $(BLASLIB)
# ScaLAPACK
ifneq ($(MPI), NONE)
ifeq ($(MPI), IMPI)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
else
ifeq ($(MPI), OPENMPI)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
else
ifeq ($(MPI), MPICH)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
else
ifeq ($(MPI_BASE), MPICH)
BLASLIB = $(MKLOPT)
LAPACKLIB = $(MKLOPT)
SCALAPACKLIB = $(MKLOPT)
else
ifeq ("$(shell uname)", "Linux")
MKL_LIBDIR := ${MKLROOT}/lib/intel64
# BLAS
ifeq ($(COMPILER), INTEL)
BLASLIB = -Wl,--start-group \
${MKL_LIBDIR}/libmkl_intel_lp64.a \
${MKL_LIBDIR}/libmkl_intel_thread.a \
${MKL_LIBDIR}/libmkl_core.a \
-Wl,--end-group -liomp5
endif
ifeq ($(COMPILER), GCC)
BLASLIB = -Wl,--start-group \
${MKL_LIBDIR}/libmkl_gf_lp64.a \
${MKL_LIBDIR}/libmkl_gnu_thread.a \
${MKL_LIBDIR}/libmkl_core.a \
-Wl,--end-group -lgomp -ldl
endif
# LAPACK
LAPACKLIB = $(BLASLIB)
# ScaLAPACK
ifneq ($(MPI), NONE)
ifeq ($(MPI), IMPI)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
else
ifeq ($(MPI_BASE), OPENMPI)
ifeq ($(MPI), OPENMPI)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
else
$(error MPI_BASE not supported by Intel MKL: MPI_BASE = $(MPI_BASE))
ifeq ($(MPI), MPICH)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
else
ifeq ($(MPI_BASE), MPICH)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
else
ifeq ($(MPI_BASE), OPENMPI)
SCALAPACKLIB = -L${MKL_LIBDIR} -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
else
$(error MPI_BASE not supported by Intel MKL: MPI_BASE = $(MPI_BASE))
endif
endif
endif
endif
endif
endif
endif
else
ifeq ("$(shell uname)", "Darwin")
MKL_LIBDIR := ${MKLROOT}/lib
# BLAS
BLASLIB = -L${MKL_LIBDIR} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
# LAPACK
LAPACKLIB = $(BLASLIB)
# ScaLAPACK
ifneq ($(MPI), NONE)
ifeq ($(MPI), MPICH)
SCALAPACKLIB = -lmkl_scalapack_lp64 -lmkl_blacs_mpich_lp64
else
PACKAGES += $(SCALAPACK).tgz
PKG_DIRS += $(SCALAPACK)
TARGET += scalapack
SCALAPACKLIB = -L$(PREFIX)/$(SCALAPACK)/lib -lscalapack
endif
endif
endif
else
ifeq ("$(shell uname)", "Darwin")
MKL_LIBDIR := ${MKLROOT}/lib
BLASLIB = -L${MKL_LIBDIR} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
# LAPACK
LAPACKLIB = $(BLASLIB)
# ScaLAPACK
ifneq ($(MPI), NONE)
ifeq ($(MPI), MPICH)
SCALAPACKLIB = -lmkl_scalapack_lp64 -lmkl_blacs_mpich_lp64
else
PACKAGES += $(SCALAPACK).tgz
PKG_DIRS += $(SCALAPACK)
TARGET += scalapack
SCALAPACKLIB = -L$(PREFIX)/$(SCALAPACK)/lib -lscalapack
endif
endif
endif
endif
else
ifeq ($(BLASLAPACK), FUJITSU)
BLASLIB = -SSL2BLAMP
Expand Down
4 changes: 4 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ BLASLAPACK = OpenBLAS
# additional configure option for ATLAS
#ATLAS_CONFIG_FLAGS = --cripple-atlas-performance

# when BLASLAPACK==MKL and COMPILER==INTEL, MKLOPT can be specified
# MKLOPT (optional): option to link with MKL
#MKLOPT = -qmkl=cluster

# when BLASLAPACK==SYSTEM, BLASLIB and LAPACKLIB can be specified
# BLASLIB (optional): system BLAS lib (default: -lblas)
#BLASLIB = -lblas
Expand Down

0 comments on commit 53707ad

Please sign in to comment.