Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Slow linking Fortran DLL with C++ program

chojrkict_re_kr
Beginner
1,551 Views

I have a big numerical simulation code, which is mainly written in C/C++(compiled by MSVC2008) and linked to some fotran DLL(by intel fotran). It also use intel MKL. Recent versions of Intel fortran is very slow in linking, also in running. For example, it takes about 10 minutes for whole compliation in release mode, especially too slow in linking(I checked it by task manager). There are no problem in debug mode(about less than 1 minute). Also runing time of program is also so slow, comparing that using older version of intel fortran.

Please help me what is problem !!!

0 Kudos
6 Replies
chojrkict_re_kr
Beginner
1,551 Views
I use import library with proper path. More specifically(the library and program name is renamed for simplicity),

arpack.lib (compiled from intel fortran) ...static library
arapckWrap.dll and arapckWrap.lib ( C wrapper compiled from MSVC ... linked to arpack.lib) ... dll/import library
myLib.lib ( C++ class library from MSVC ... use intel MKL) ... major libary, static library
myProg.exe ( C++ program form MSVC) ... linked with arpackWrap.lib, myLib.lib


Previous version of intel fortran hadno problem. After upgrading it, it takes too many time for linking, also it shows too slow at running. When turning on Verbose option, pass 2 of link is very time consumming.

Hence I triesto return to preivous version(intel fortran 2011 Update 7),butsame pheonona occurs. I don't know what is wrong.
0 Kudos
TimP
Honored Contributor III
1,551 Views
Time-consuming link is often due to IPO. It's on by default in Visual Studio setup. You would unset the corresponding VS project propery, set /Qipo- and avoid /fast for all sources, and possibly set /qnoipo in your link step, in order to verify this. When you make significant use of libraries which you don't compile with ifort or icl, IPO is not so likely to be advantageous.
Slow running could indicate that you left an important file compiled in debug mode.
0 Kudos
Steven_L_Intel1
Employee
1,551 Views
IPO is not the issue here, as that is not on by default. There is probably a lot of object code being generated and read. Can you provide us with a test case?
0 Kudos
chojrkict_re_kr
Beginner
1,551 Views

he code is very big, so I can not send it. And I have no time to prepare test case.

However I get a clue to solve the probelm. First I show you my case for more specifically.

1. arpack.lib : fortran static library (ARAPCK : eigenvalue routine)

2. math.dll, math.lib : C code. Simple algebra routine + wrapper for ARPACK and pardiso in intelMKL.

3. solver.lib : C++ liner/eigen solver class library. It use math.dll

4. core.lib : very big C++ class library. It use math.dll and solver.lib.

It also uses openmp, so I ignore vcomp.lib in MSVC for libiomp

5. analyzer.exe : linked to core.lib, solver.lib, math.lib, libiomp.lib

I use MSVC 2008 for C/C++ and Intel fortran 2011 Update 8 for Fortran and intel MKL.

Follows are what I have done.

1. Upgrading Intel Fortran 2011 Update 8.

--> Debug version of analyzer.exe : no problem

--> Release version of analyer.exe : slow linking and running

2. I changed some link option, but I can not resolve it.

3. I downgrade to Intel Fortran 2011 Udpate 7.

--> Same problem, which was not before upgrade.

4. I reset library in Additonal dependencies in MSVC. ( simply deleting -> compile -> error -> reset -> success)

--> The problem is resolved.

5. I update intel Fortran 2011 Update 8 again.

--> OK.

I resolved the problem. But I still don't know the reason.

0 Kudos
tehpikachu
Beginner
1,551 Views
my sig
How did you fix the problem?
0 Kudos
Steven_L_Intel1
Employee
1,551 Views
My guess is that you had, in Additional Dependencies, the name or path to a .lib that was very large or on a network share so that reading it was slow.
0 Kudos
Reply