- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the code:
program main
implicit none
integer :: i
type Element
real(8),allocatable :: eForce(:)
end type Element
type (Element),allocatable :: elems(:)
allocate(elems(100))
!$omp parallel do private (i) schedule (guided)
do i=1,100
allocate(elems(i)%eForce(1000000))
elems(i)%eForce=1.
end do
!$omp end parallel do
write(*,*) "befor clean..."
do while (.true.)
write(*,fmt='(a,\)') "input 1 to continue:"
read(*,*) i
if(i.eq.1) exit
end do
deallocate(elems)
write(*,*) "clean finished..."
do while (.true.)
write(*,fmt='(a,\)') "input 1 to continue:"
read(*,*) i
if(i.eq.1) exit
end do
end program main
If I choose "Debug Multithreaded (/libs:static /threads /dbglibs)" in project property, after clean the allocated memory, the memory usage is still near 1GB
However, If I choose "Debug Multithread DLL (/libs:dll /threads /dbglibs)", deallocate will perform right.
I notice that IVF stop support for static link of OpenMP (https://community.intel.com/t5/Intel-Fortran-Compiler/Intel-Fortran-Static-Library-with-OpenMP-enabled/td-p/1014804)
According to the thread, Am i wrong to choose the libs:static option?
The Intel Fortran version I used is 19.1.0.166
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/libs:static doesn't affect the OpenMP library, which is DLL-only. Have you tried a more recent compiler and runtime library?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the attachment is the solution, The Intel Fortran version I used is 19.1.0.166 , the VisualStudio version is 16.9.0
Both are recent updated software
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can reproduce the difference using the 2021.0.2 compiler and libraries. What causes it, I don't know., but I do know that there can sometimes be issues mixing DLL and static linked code. If you have paid support I suggest you report this through the Intel Online Service Center. But the most pragmatic approach would be to use DLL linking, which is the default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why is the default dll, it makes a lot more sense to bind in the lib.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Linking to DLL libraries saves space, reduces memory load, and allows for DLLs to be updated without requiring a relink. Microsoft changed its defaults many years back to default to DLL linking. In the case of OpenMP, I recall a claim that there were run-time issues caused by use of a static library for OpenMP. I don't recall the details, and note that a static OMP library is still provided on Linux, but that is a different environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but in the days of Microsoft Fortran you created a single file that sat on a floppy and just ran, now it is a convoluted set of dlls. Bring back MS Fortran V 3.03 and twin floppy drives, the modern youth are spoiled.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page