I’m working on a scientific computation project in Fortran that uses Intel’s Math Kernel Library (MKL), managed through a Conda environment. I’m encountering an issue with the DLAMCH function from LAPACK.
Environment:
- OS: Ubuntu (latest LTS)
- Compiler: gfortran (version 14.1.0)
- MKL version: 2024.2.0 (intel_663 build)
- Conda environment
In my Fortran code, I’m trying to use the DLAMCH function like this:
abstol = dlamch('S')
However, I’m getting the following error:
Error: Function 'dlamch' at (1) has no IMPLICIT type
My module uses the following MKL-related modules:
module m_model
use iso_fortran_env, only: int64, real64, character_storage_size, int8, int32
use iso_c_binding
use m_myio
use m_myxyz
use mkl_service
use mkl_spblas
use mkl_solvers_ee
implicit none
! ... rest of the module ...
end module m_model
I’ve tried adding an explicit interface for DLAMCH:
interface
function dlamch(cmach) bind(C, name='dlamch_')
use, intrinsic :: iso_c_binding
implicit none
character(1), value :: cmach
real(c_double) :: dlamch
end function dlamch
end interface
But this didn’t resolve the issue.
My questions are:
- How can I properly import or declare the
dlamch
function from LAPACK/MKL in this Conda-managed environment? - Is there a specific MKL module I should be using to access LAPACK functions like DLAMCH?
- Are there any special considerations when using LAPACK functions from MKL in a Conda environment?