From d03a0af59188006fe5867af892b1d0277a99c4e7 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Tue, 10 May 2022 22:28:58 +0900 Subject: [PATCH] Use OpenMP standard instead on Intel extension --- Multiwfn.f90 | 13 +++---------- define.f90 | 1 - fileIO.f90 | 2 -- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Multiwfn.f90 b/Multiwfn.f90 index 8b26a1a..48fc0a5 100644 --- a/Multiwfn.f90 +++ b/Multiwfn.f90 @@ -10,8 +10,6 @@ real*8,allocatable :: tmparr(:),tmparr2(:),tmpmat(:,:),tmpmat2(:,:),tmpmat3D(:,: integer,allocatable :: tmparri(:),tmparr2i(:),tmpmati(:,:),tmpmat2i(:,:) real*8 tmpv1(3),tmpv2(3) -call kmp_set_warnings_off() !In rare case, "Cannot open message catalog "1041\libiomp5ui.dll"" may occurs, this calling avoid this problem, or user should set KMP_WARNINGS environment variable to 0 - !Try to get input file name from argument, which should be the first argument filename=" " narg=command_argument_count() @@ -40,14 +38,9 @@ call date_and_time(nowdate,nowtime) write(*,"(/,' ( Number of parallel threads:',i4,' Current date: ',a,'-',a,'-',a,' Time: ',a,':',a,':',a,' )')") & nthreads,nowdate(1:4),nowdate(5:6),nowdate(7:8),nowtime(1:2),nowtime(3:4),nowtime(5:6) -!For Linux/MacOS version, it seems the only way to set stacksize of each thread is to define KMP_STACKSIZE environment variable -if (isys==1) then !Set via ompstacksize in settings.ini - call KMP_SET_STACKSIZE_S(ompstacksize) -else if (isys==2) then !The size should have been defined by KMP_STACKSIZE - CALL getenv('KMP_STACKSIZE',c200tmp) - if (c200tmp==" ") write(*,"(/,a)") " Warning: You should set ""KMP_STACKSIZE"" environment variable as mentioned in Section 2.1.2 of Multiwfn manual!" -end if -!write(*,"(' OpenMP stacksize for each thread: ',f10.2,' MB')") dfloat(KMP_GET_STACKSIZE_S())/1024/1024 +!For Windows/Linux/MacOS version, the only way to set stacksize of each thread is to define OMP_STACKSIZE environment variable (have a look at OpenMP standard, even novel) +CALL get_environment_variable('OMP_STACKSIZE',c200tmp) +if (c200tmp==" ") write(*,"(/,a)") " Warning: You should set ""OMP_STACKSIZE"" environment variable as mentioned in Section 2.1.2 of Multiwfn manual!" call mkl_set_num_threads(nthreads) !Use this to set number of cores used in MKL library (e.g. function matmul_blas) !!-------- Load input file diff --git a/define.f90 b/define.f90 index ba7efe3..08c6fce 100644 --- a/define.f90 +++ b/define.f90 @@ -439,7 +439,6 @@ real*8 :: bndordthres=0.05D0,compthres=0.5D0,compthresCDA=1D0,expcutoff=-40D0,ex integer :: PBCnx,PBCny,PBCnz,ifdoPBCx,ifdoPBCy,ifdoPBCz !PBC setting actually used in calculation, they will be specified by init_PBC integer :: PBCnx_in=1,PBCny_in=1,PBCnz_in=1,ifdoPBCx_in=1,ifdoPBCy_in=1,ifdoPBCz_in=1 !PBC setting read from settings.ini integer :: nthreads=4 -integer*8 :: ompstacksize=200000000 character :: lastfile*200="",gaupath*200="",cubegenpath*200="",formchkpath*200="",orcapath*200="",orca_2mklpath*200="",cubegendenstype*80="SCF" !! About function calculation, external or internal parameters integer :: RDG_addminimal=1,ELF_addminimal=1,num1Dpoints=3000,atomdenscut=1,nprevorbgrid=120000,paircorrtype=3,pairfunctype=1,srcfuncmode=1 diff --git a/fileIO.f90 b/fileIO.f90 index 3e4d460..e8e4369 100644 --- a/fileIO.f90 +++ b/fileIO.f90 @@ -11037,8 +11037,6 @@ if (ifound==0) then call get_option_str(20,'nthreads=',c80tmp) if (c80tmp/=" ") read(c80tmp,*) nthreads end if -call get_option_str(20,'ompstacksize=',c80tmp) -if (c80tmp/=" ") read(c80tmp,*) ompstacksize call get_option_str(20,'gaupath=',c200tmp) if (c200tmp/=" ") read(c200tmp,*) gaupath call get_option_str(20,'cubegenpath=',c200tmp) -- 2.25.1