• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision1b3d28b6f186d9249e3fc410ae2d16c4f93e61cd (tree)
l'heure2013-11-01 17:35:40
AuteurMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Message de Log

schedule(auto) in openMP is changed to dynamical schedule. #32381

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1560 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Modification

--- a/src/base/loggers/DensityLogger.cpp
+++ b/src/base/loggers/DensityLogger.cpp
@@ -28,6 +28,7 @@
2828 #include<stdexcept>
2929 #include<omp.h>
3030 #include<boost/format.hpp>
31+#include"../../config.h"
3132 #include"../Enums.h"
3233 #include"../Uncopyable.h"
3334 #include"../PrintController.h"
@@ -106,7 +107,7 @@ void DensityLogger::DrawDensity(vector<int> elecStateIndeces) const{
106107
107108 // density output
108109 stringstream ompErrors;
109-#pragma omp parallel for schedule(auto)
110+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
110111 for(int n=0; n<elecStateIndeces.size(); n++){
111112 try{
112113 // validate electronic state
--- a/src/base/loggers/MOLogger.cpp
+++ b/src/base/loggers/MOLogger.cpp
@@ -28,6 +28,7 @@
2828 #include<stdexcept>
2929 #include<omp.h>
3030 #include<boost/format.hpp>
31+#include"../../config.h"
3132 #include"../Enums.h"
3233 #include"../Uncopyable.h"
3334 #include"../PrintController.h"
@@ -91,7 +92,7 @@ void MOLogger::DrawMO(vector<int> moIndeces){
9192
9293 // MO output
9394 stringstream ompErrors;
94-#pragma omp parallel for schedule(auto)
95+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
9596 for(int i=0; i<moIndeces.size(); i++){
9697 try{
9798 // validate mo number
--- a/src/cndo/Cndo2.cpp
+++ b/src/cndo/Cndo2.cpp
@@ -28,6 +28,7 @@
2828 #include<stdexcept>
2929 #include<omp.h>
3030 #include<boost/format.hpp>
31+#include"../config.h"
3132 #include"../base/Enums.h"
3233 #include"../base/Uncopyable.h"
3334 #include"../base/PrintController.h"
@@ -871,7 +872,7 @@ void Cndo2::DoDIIS(double** orbitalElectronPopulation,
871872 &diisStoredErrorVect[diisNumErrorVect-1][0][0],
872873 &diisErrorProducts[diisNumErrorVect-1][0]);
873874
874-#pragma omp parallel for schedule(auto)
875+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
875876 for(int mi=0; mi<diisNumErrorVect; mi++){
876877 diisErrorProducts[mi][diisNumErrorVect-1] = diisErrorProducts[diisNumErrorVect-1][mi];
877878 diisErrorProducts[mi][diisNumErrorVect] = -1.0;
@@ -889,7 +890,7 @@ void Cndo2::DoDIIS(double** orbitalElectronPopulation,
889890 if(diisNumErrorVect <= step && diisEndError<diisError && diisError<diisStartError){
890891 hasAppliedDIIS = true;
891892 try{
892-#pragma omp parallel for schedule(auto)
893+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
893894 for(int i=0; i<diisNumErrorVect+1; i++){
894895 for(int j=0; j<diisNumErrorVect+1; j++){
895896 tmpDiisErrorProducts[i][j] = diisErrorProducts[i][j];
@@ -937,7 +938,7 @@ void Cndo2::DoDamp(double rmsDensity,
937938 if(0.0 < dampingWeight && dampingThresh < rmsDensity){
938939 hasAppliedDamping = true;
939940 stringstream ompErrors;
940-#pragma omp parallel for schedule(auto)
941+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
941942 for(int j=0; j<totalNumberAOs; j++){
942943 try{
943944 for(int k=0; k<totalNumberAOs; k++){
@@ -1317,7 +1318,7 @@ double Cndo2::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL,
13171318 void Cndo2::UpdateOldOrbitalElectronPopulation(double** oldOrbitalElectronPopulation,
13181319 double const* const* orbitalElectronPopulation,
13191320 int numberAOs) const{
1320-#pragma omp parallel for schedule(auto)
1321+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
13211322 for(int i=0; i<numberAOs; i++){
13221323 for(int j=0; j<numberAOs; j++){
13231324 oldOrbitalElectronPopulation[i][j] = orbitalElectronPopulation[i][j];
@@ -1336,7 +1337,7 @@ bool Cndo2::SatisfyConvergenceCriterion(double const* const * oldOrbitalElectron
13361337 bool satisfy = false;
13371338 double change = 0.0;
13381339 stringstream ompErrors;
1339-#pragma omp parallel for schedule(auto) reduction(+:change)
1340+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE) reduction(+:change)
13401341 for(int i=0; i<numberAOs; i++){
13411342 try{
13421343 for(int j=0; j<numberAOs; j++){
@@ -1406,7 +1407,7 @@ void Cndo2::CalcFockMatrix(double** fockMatrix,
14061407 for(int mu=firstAOIndexA; mu<=lastAOIndexA; mu++){
14071408 int calcRank = mu%mpiSize;
14081409 if(mpiRank == calcRank){
1409-#pragma omp parallel for schedule(auto)
1410+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
14101411 for(int B=A; B<totalNumberAtoms; B++){
14111412 try{
14121413 const Atom& atomB = *molecule.GetAtom(B);
@@ -1587,7 +1588,7 @@ void Cndo2::CalcAtomicElectronPopulation(double* atomicElectronPopulation,
15871588 const Molecule& molecule) const{
15881589 int totalNumberAtoms = molecule.GetNumberAtoms();
15891590 MallocerFreer::GetInstance()->Initialize<double>(atomicElectronPopulation, totalNumberAtoms);
1590-#pragma omp parallel for schedule(auto)
1591+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
15911592 for(int A=0; A<totalNumberAtoms; A++){
15921593 int firstAOIndex = molecule.GetAtom(A)->GetFirstAOIndex();
15931594 int numberAOs = molecule.GetAtom(A)->GetValenceSize();
@@ -1617,7 +1618,7 @@ void Cndo2::CalcGammaAB(double** gammaAB, const Molecule& molecule) const{
16171618 int na = atomA.GetValenceShellType() + 1;
16181619 double orbitalExponentA = atomA.GetOrbitalExponent(
16191620 atomA.GetValenceShellType(), s, this->theory);
1620-#pragma omp parallel for schedule(auto)
1621+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
16211622 for(int B=A; B<totalAtomNumber; B++){
16221623 try{
16231624 const Atom& atomB = *molecule.GetAtom(B);
@@ -1697,7 +1698,7 @@ void Cndo2::CalcGammaAB(double** gammaAB, const Molecule& molecule) const{
16971698 MolDS_mpi::molds_mpi_int num = totalAtomNumber*totalAtomNumber;
16981699 MolDS_mpi::MpiProcess::GetInstance()->Broadcast(buff, num, mpiHeadRank);
16991700
1700-#pragma omp parallel for schedule(auto)
1701+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
17011702 for(int A=0; A<totalAtomNumber; A++){
17021703 for(int B=0; B<A; B++){
17031704 gammaAB[A][B] = gammaAB[B][A];
@@ -1813,7 +1814,7 @@ void Cndo2::CalcCartesianMatrixByGTOExpansion(double*** cartesianMatrix,
18131814 if(mpiRank == calcRank){
18141815 for(int a=0; a<numValenceAOsA; a++){
18151816 int mu = firstAOIndexA + a;
1816-#pragma omp parallel for schedule(auto)
1817+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
18171818 for(int B=0; B<totalAtomNumber; B++){
18181819 try{
18191820 const Atom& atomB = *molecule.GetAtom(B);
@@ -3793,7 +3794,7 @@ void Cndo2::CalcOverlapAOsWithAnotherConfiguration(double** overlapAOs,
37933794 overlapAOs[mu][mu] = 1.0;
37943795 }
37953796 bool isSymmetricOverlapAOs = false;
3796-#pragma omp for schedule(auto)
3797+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
37973798 for(int A=0; A<totalAtomNumber; A++){
37983799 const Atom& lhsAtom = *lhsMolecule.GetAtom(A);
37993800 const Atom& rhsAtom = *rhsMolecule->GetAtom(A);
@@ -3937,7 +3938,7 @@ void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{
39373938 MallocerFreer::GetInstance()->Malloc<double>(&tmpVectorBC,
39383939 OrbitalType_end*OrbitalType_end);
39393940 bool symmetrize = false;
3940-#pragma omp for schedule(auto)
3941+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
39413942 for(int B=A+1; B<totalAtomNumber; B++){
39423943 const Atom& atomB = *molecule.GetAtom(B);
39433944 this->CalcDiatomicOverlapAOsInDiatomicFrame(diatomicOverlapAOs, atomA, atomB);
@@ -3986,7 +3987,7 @@ void Cndo2::CalcOverlapAOs(double** overlapAOs, const Molecule& molecule) const{
39863987 MolDS_mpi::molds_mpi_int num = totalAONumber*totalAONumber;
39873988 MolDS_mpi::MpiProcess::GetInstance()->Broadcast(buff, num, mpiHeadRank);
39883989
3989- #pragma omp parallel for schedule(auto)
3990+ #pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
39903991 for(int mu=0; mu<totalAONumber; mu++){
39913992 overlapAOs[mu][mu] = 1.0;
39923993 for(int nu=mu+1; nu<totalAONumber; nu++){
@@ -4321,7 +4322,7 @@ void Cndo2::CalcOverlapAOsByGTOExpansion(double** overlapAOs,
43214322 }
43224323
43234324 stringstream ompErrors;
4324-#pragma omp parallel for schedule(auto)
4325+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
43254326 for(int A=0; A<totalAtomNumber; A++){
43264327 try{
43274328 const Atom& atomA = *molecule.GetAtom(A);
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,27 @@
1+//************************************************************************//
2+// Copyright (C) 2011-2013 Mikiya Fujii //
3+// //
4+// This file is part of MolDS. //
5+// //
6+// MolDS is free software: you can redistribute it and/or modify //
7+// it under the terms of the GNU General Public License as published by //
8+// the Free Software Foundation, either version 3 of the License, or //
9+// (at your option) any later version. //
10+// //
11+// MolDS is distributed in the hope that it will be useful, //
12+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
13+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14+// GNU General Public License for more details. //
15+// //
16+// You should have received a copy of the GNU General Public License //
17+// along with MolDS. If not, see <http://www.gnu.org/licenses/>. //
18+//************************************************************************//
19+#ifndef INCLUDED_CONFIG
20+#define INCLUDED_CONFIG
21+namespace MolDS_base{
22+#define MOLDS_OMP_DYNAMIC_CHUNK_SIZE 3
23+}
24+#endif
25+
26+
27+
--- a/src/indo/Indo.cpp
+++ b/src/indo/Indo.cpp
@@ -25,6 +25,7 @@
2525 #include<vector>
2626 #include<stdexcept>
2727 #include<boost/format.hpp>
28+#include"../config.h"
2829 #include"../base/Enums.h"
2930 #include"../base/Uncopyable.h"
3031 #include"../base/PrintController.h"
--- a/src/md/MD.cpp
+++ b/src/md/MD.cpp
@@ -26,6 +26,7 @@
2626 #include<stdexcept>
2727 #include<boost/shared_ptr.hpp>
2828 #include<boost/format.hpp>
29+#include"../config.h"
2930 #include"../base/Enums.h"
3031 #include"../base/Uncopyable.h"
3132 #include"../base/PrintController.h"
@@ -136,7 +137,7 @@ void MD::DoMD(){
136137 }
137138
138139 void MD::UpdateMomenta(const Molecule& molecule, double const* const* matrixForce, double dt) const{
139-#pragma omp parallel for schedule(auto)
140+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
140141 for(int a=0; a<molecule.GetNumberAtoms(); a++){
141142 Atom* atom = molecule.GetAtom(a);
142143 for(int i=0; i<CartesianType_end; i++){
@@ -146,7 +147,7 @@ void MD::UpdateMomenta(const Molecule& molecule, double const* const* matrixForc
146147 }
147148
148149 void MD::UpdateCoordinates(Molecule& molecule, double dt) const{
149-#pragma omp parallel for schedule(auto)
150+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
150151 for(int a=0; a<molecule.GetNumberAtoms(); a++){
151152 Atom* atom = molecule.GetAtom(a);
152153 double coreMass = atom->GetAtomicMass() - static_cast<double>(atom->GetNumberValenceElectrons());
--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -26,6 +26,7 @@
2626 #include<stdexcept>
2727 #include<omp.h>
2828 #include<boost/format.hpp>
29+#include"../config.h"
2930 #include"../base/Enums.h"
3031 #include"../base/Uncopyable.h"
3132 #include"../base/PrintController.h"
@@ -761,7 +762,7 @@ void Mndo::CalcCISMatrix(double** matrixCIS) const{
761762 int moI = this->GetActiveOccIndex(*this->molecule, k);
762763 int moA = this->GetActiveVirIndex(*this->molecule, k);
763764 stringstream ompErrors;
764-#pragma omp parallel for schedule(auto)
765+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
765766 for(int l=k; l<this->matrixCISdimension; l++){
766767 try{
767768 // single excitation from J-th (occupied)MO to B-th (virtual)MO
@@ -1770,7 +1771,7 @@ void Mndo::CalcHessianSCF(double** hessianSCF, bool isMassWeighted) const{
17701771 &tmpRotatedDiatomicOverlapVec,
17711772 &tmpMatrixBC,
17721773 &tmpVectorBC);
1773-#pragma omp for schedule(auto)
1774+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
17741775 for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){
17751776 const Atom& atomA = *this->molecule->GetAtom(indexAtomA);
17761777 int firstAOIndexA = atomA.GetFirstAOIndex();
@@ -1945,7 +1946,7 @@ void Mndo::CalcOrbitalElectronPopulation1stDerivatives(double**** orbitalElectro
19451946 this->SolveCPHF(solutionsCPHF, nonRedundantQIndeces, redundantQIndeces);
19461947 this->TransposeFockMatrixMatrix(transposedFockMatrix);
19471948 stringstream ompErrors;
1948-#pragma omp parallel for schedule(auto)
1949+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
19491950 for(int mu=0; mu<totalNumberAOs; mu++){
19501951 try{
19511952 for(int nu=0; nu<totalNumberAOs; nu++){
@@ -2036,7 +2037,7 @@ void Mndo::CalcStaticFirstOrderFocks(double** staticFirstOrderFocks,
20362037 const vector<MoIndexPair>& nonRedundantQIndeces,
20372038 const vector<MoIndexPair>& redundantQIndeces) const{
20382039 stringstream ompErrors;
2039-#pragma omp parallel for schedule(auto)
2040+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
20402041 for(int indexAtomA=0; indexAtomA<this->molecule->GetNumberAtoms(); indexAtomA++){
20412042 try{
20422043 for(int axisA=XAxis; axisA<CartesianType_end; axisA++){
@@ -2325,7 +2326,7 @@ void Mndo::CalcMatrixCPHF(double** matrixCPHF,
23252326 {
23262327 try{
23272328 // calc diagonal part of N
2328-#pragma omp for schedule(auto)
2329+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
23292330 for(int i=0; i<dimensionCPHF; i++){
23302331 if(i<nonRedundantQIndeces.size()){
23312332 int moI = nonRedundantQIndeces[i].moI;
@@ -2340,7 +2341,7 @@ void Mndo::CalcMatrixCPHF(double** matrixCPHF,
23402341 }
23412342
23422343 // calc (\Gamma - K)N
2343-#pragma omp for schedule(auto)
2344+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
23442345 for(int i=0; i<nonRedundantQIndeces.size(); i++){
23452346 int moI = nonRedundantQIndeces[i].moI;
23462347 int moJ = nonRedundantQIndeces[i].moJ;
@@ -2352,7 +2353,7 @@ void Mndo::CalcMatrixCPHF(double** matrixCPHF,
23522353 }
23532354 }
23542355
2355-#pragma omp for schedule(auto)
2356+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
23562357 for(int i=nonRedundantQIndeces.size(); i<dimensionCPHF; i++){
23572358 int moI = redundantQIndeces[i-nonRedundantQIndeces.size()].moI;
23582359 int moJ = redundantQIndeces[i-nonRedundantQIndeces.size()].moJ;
@@ -2363,7 +2364,7 @@ void Mndo::CalcMatrixCPHF(double** matrixCPHF,
23632364 }
23642365 }
23652366
2366-#pragma omp for schedule(auto)
2367+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
23672368 for(int i=nonRedundantQIndeces.size(); i<dimensionCPHF; i++){
23682369 int moI = redundantQIndeces[i-nonRedundantQIndeces.size()].moI;
23692370 int moJ = redundantQIndeces[i-nonRedundantQIndeces.size()].moJ;
@@ -2633,7 +2634,7 @@ void Mndo::CalcForce(const vector<int>& elecStates){
26332634 &tmpVectorBC,
26342635 &tmpDiatomicTwoElecTwoCore);
26352636
2636-#pragma omp for schedule(auto)
2637+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
26372638 for(int b=0; b<this->molecule->GetNumberAtoms(); b++){
26382639 if(a == b){continue;}
26392640 const Atom& atomB = *molecule->GetAtom(b);
@@ -3523,7 +3524,7 @@ void Mndo::CalcTwoElecTwoCore(double****** twoElecTwoCore,
35233524 MallocerFreer::GetInstance()->Malloc<double>(&tmpMatrixBC, dxy*dxy, dxy*dxy);
35243525 MallocerFreer::GetInstance()->Malloc<double>(&tmpVectorBC, dxy*dxy*dxy*dxy);
35253526 // note that terms with condition a==b are not needed to calculate.
3526-#pragma omp for schedule(auto)
3527+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
35273528 for(int b=a+1; b<totalNumberAtoms; b++){
35283529 this->CalcDiatomicTwoElecTwoCore(diatomicTwoElecTwoCore,
35293530 tmpDiatomicTwoElecTwoCore,
@@ -3574,7 +3575,7 @@ void Mndo::CalcTwoElecTwoCore(double****** twoElecTwoCore,
35743575 throw MolDSException::Deserialize(errorStream);
35753576 }
35763577
3577-#pragma omp parallel for schedule(auto)
3578+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
35783579 for(int a=0; a<totalNumberAtoms; a++){
35793580 for(int b=a+1; b<totalNumberAtoms; b++){
35803581 int i=0;
--- a/src/optimization/BFGS.cpp
+++ b/src/optimization/BFGS.cpp
@@ -29,6 +29,7 @@
2929 #include<stdexcept>
3030 #include<boost/shared_ptr.hpp>
3131 #include<boost/format.hpp>
32+#include"../config.h"
3233 #include"../base/Enums.h"
3334 #include"../base/Uncopyable.h"
3435 #include"../base/PrintController.h"
@@ -381,7 +382,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian,
381382 vectorsRedundantModes[c] = &matrixesRedundantModes[c][0][0];
382383 }
383384 for(int c=0; c<numTranslationalModes;c++){
384-#pragma omp parallel for schedule(auto)
385+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
385386 for(int n=0;n<numAtoms;n++){
386387 for(int d=0;d<CartesianType_end;d++){
387388 matrixesRedundantModes[c][n][d] = c==d? 1.0 : 0.0;
@@ -394,7 +395,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian,
394395 vectorsRedundantModes[c+numTranslationalModes] = &matrixesRedundantModes[c+numTranslationalModes][0][0];
395396 }
396397 for(int c=0; c<numRotationalModes;c++){
397-#pragma omp parallel for schedule(auto)
398+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
398399 for(int n=0;n<numAtoms;n++){
399400 const double* xyz = molecule.GetAtom(n)->GetXyz();
400401 for(int d=0;d<CartesianType_end;d++){
--- a/src/optimization/GEDIIS.cpp
+++ b/src/optimization/GEDIIS.cpp
@@ -28,6 +28,7 @@
2828 #include<stdexcept>
2929 #include<boost/shared_ptr.hpp>
3030 #include<boost/format.hpp>
31+#include"../config.h"
3132 #include"../base/Enums.h"
3233 #include"../base/Uncopyable.h"
3334 #include"../base/PrintController.h"
@@ -289,7 +290,7 @@ GEDIIS::GEDIISHistory::Entry::Entry(double energy,
289290 energy(energy),numAtoms(molecule.GetNumberAtoms()),matrixCoordinate(NULL),matrixForce(NULL) {
290291 MallocerFreer::GetInstance()->Malloc(&this->matrixCoordinate, this->numAtoms, CartesianType_end);
291292 MallocerFreer::GetInstance()->Malloc(&this->matrixForce, this->numAtoms, CartesianType_end);
292-#pragma omp parallel for schedule(auto)
293+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
293294 for(int i = 0; i < this->numAtoms; i++){
294295 const Atom* atom = molecule.GetAtom(i);
295296 const double* xyz = atom->GetXyz();
--- a/src/optimization/Optimizer.cpp
+++ b/src/optimization/Optimizer.cpp
@@ -27,6 +27,7 @@
2727 #include<stdexcept>
2828 #include<boost/shared_ptr.hpp>
2929 #include<boost/format.hpp>
30+#include"../config.h"
3031 #include"../base/Enums.h"
3132 #include"../base/Uncopyable.h"
3233 #include"../base/PrintController.h"
@@ -129,7 +130,7 @@ void Optimizer::CheckEnableTheoryType(TheoryType theoryType) const{
129130 }
130131
131132 void Optimizer::ClearMolecularMomenta(Molecule& molecule) const{
132-#pragma omp parallel for schedule(auto)
133+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
133134 for(int a=0; a<molecule.GetNumberAtoms(); a++){
134135 const Atom* atom = molecule.GetAtom(a);
135136 atom->SetPxyz(0.0, 0.0, 0.0);
@@ -137,7 +138,7 @@ void Optimizer::ClearMolecularMomenta(Molecule& molecule) const{
137138 }
138139
139140 void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* const* matrixForce, double dt) const{
140-#pragma omp parallel for schedule(auto)
141+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
141142 for(int a=0; a<molecule.GetNumberAtoms(); a++){
142143 const Atom* atom = molecule.GetAtom(a);
143144 double coreMass = atom->GetAtomicMass() - static_cast<double>(atom->GetNumberValenceElectrons());
@@ -149,7 +150,7 @@ void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* con
149150 }
150151
151152 void Optimizer::UpdateMolecularCoordinates(Molecule& molecule, double const* const* matrixForce) const{
152-#pragma omp parallel for schedule(auto)
153+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
153154 for(int a=0; a<molecule.GetNumberAtoms(); a++){
154155 const Atom* atom = molecule.GetAtom(a);
155156 for(int i=0; i<CartesianType_end; i++){
--- a/src/wrappers/Blas.cpp
+++ b/src/wrappers/Blas.cpp
@@ -25,6 +25,7 @@
2525 #include<string>
2626 #include<stdexcept>
2727 #include<boost/format.hpp>
28+#include"../config.h"
2829 #include"../base/Uncopyable.h"
2930 #include"../base/PrintController.h"
3031 #include"../base/MolDSException.h"
@@ -239,7 +240,7 @@ void Blas::Dsyr(molds_blas_int n, double alpha,
239240 CBLAS_UPLO uploA=CblasUpper;
240241 molds_blas_int lda = n;
241242 cblas_dsyr(CblasRowMajor, uploA, n, alpha, x, incrementX, a, lda);
242-#pragma omp parallel for schedule(auto)
243+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
243244 for(molds_blas_int i=0;i<n;i++){
244245 for(molds_blas_int j=i+1;j<n;j++){
245246 matrixA[j][i] = matrixA[i][j]; // Note that output matrixA is row-major(C/C++ stype)
@@ -542,7 +543,7 @@ void Blas::Dsyrk(molds_blas_int n, molds_blas_int k,
542543 molds_blas_int lda = &matrixA[1][0] - &matrixA[0][0];
543544 molds_blas_int ldc = &matrixC[1][0] - &matrixC[0][0];
544545 cblas_dsyrk(orderA, uploC, transA, n, k, alpha, a, lda, beta, c, ldc);
545-#pragma omp parallel for schedule(auto)
546+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
546547 for(molds_blas_int i=0;i<n;i++){
547548 for(molds_blas_int j=i+1;j<n;j++){
548549 if(isLowerTriangularPartMatrixCUsed){
--- a/src/zindo/ZindoS.cpp
+++ b/src/zindo/ZindoS.cpp
@@ -28,6 +28,7 @@
2828 #include<algorithm>
2929 #include<omp.h>
3030 #include<boost/format.hpp>
31+#include"../config.h"
3132 #include"../base/Enums.h"
3233 #include"../base/Uncopyable.h"
3334 #include"../base/PrintController.h"
@@ -732,7 +733,7 @@ double ZindoS::GetNishimotoMatagaTwoEleInt1stDerivative(const Atom& atomA,
732733 void ZindoS::CalcNishimotoMatagaMatrix(double**** nishimotoMatagaMatrix, const Molecule& molecule) const{
733734 int totalNumberAtoms = molecule.GetNumberAtoms();
734735 stringstream ompErrors;
735-#pragma omp parallel for schedule(auto)
736+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
736737 for(int A=0; A<totalNumberAtoms; A++){
737738 try{
738739 const Atom& atomA = *molecule.GetAtom(A);
@@ -1170,7 +1171,7 @@ void ZindoS::CalcCISProperties(){
11701171 this->electronicTransitionDipoleMoments[excitedState][excitedState][YAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][YAxis];
11711172 this->electronicTransitionDipoleMoments[excitedState][excitedState][ZAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][ZAxis];
11721173 double tmpX=0.0, tmpY=0.0, tmpZ=0.0;
1173-#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto)
1174+#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
11741175 for(int l=0; l<this->matrixCISdimension; l++){
11751176 // single excitation from I-th (occupied)MO to A-th (virtual)MO
11761177 int moI = this->GetActiveOccIndex(*this->molecule, l);
@@ -1201,7 +1202,7 @@ void ZindoS::CalcCISProperties(){
12011202 this->electronicTransitionDipoleMoments[excitedState][groundState][YAxis] = 0.0;
12021203 this->electronicTransitionDipoleMoments[excitedState][groundState][ZAxis] = 0.0;
12031204 double tmpX=0.0, tmpY=0.0, tmpZ=0.0;
1204-#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto)
1205+#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
12051206 for(int l=0; l<this->matrixCISdimension; l++){
12061207 // single excitation from I-th (occupied)MO to A-th (virtual)MO
12071208 int moI = this->GetActiveOccIndex(*this->molecule, l);
@@ -1226,7 +1227,7 @@ void ZindoS::CalcCISProperties(){
12261227 this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][YAxis] = 0.0;
12271228 this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][ZAxis] = 0.0;
12281229 double tmpX=0.0, tmpY=0.0, tmpZ=0.0;
1229-#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto)
1230+#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
12301231 for(int l=0; l<this->matrixCISdimension; l++){
12311232 // single excitation from I-th (occupied)MO to A-th (virtual)MO
12321233 int moI = this->GetActiveOccIndex(*this->molecule, l);
@@ -1424,7 +1425,7 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
14241425 if(from != to){
14251426 if(from != groundState && to != groundState){
14261427 // transition dipole moment between different excited states
1427-#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(auto)
1428+#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
14281429 for(int l=0; l<this->matrixCISdimension; l++){
14291430 try{
14301431 double temp = 0.0;
@@ -1462,7 +1463,7 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
14621463 }
14631464 else if(from == groundState && to != groundState){
14641465 // transition dipole moment from the ground to excited states
1465-#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(auto)
1466+#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
14661467 for(int l=0; l<this->matrixCISdimension; l++){
14671468 try{
14681469 double temp = 0.0;
@@ -1500,7 +1501,7 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
15001501 }
15011502 else if(from != groundState && to == groundState){
15021503 // transition dipole moment from the excited to ground states
1503-#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(auto)
1504+#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
15041505 for(int l=0; l<this->matrixCISdimension; l++){
15051506 try{
15061507 double temp = 0.0;
@@ -1540,7 +1541,7 @@ void ZindoS::CalcElectronicTransitionDipoleMoment(double* transitionDipoleMoment
15401541 else{
15411542 if(from != groundState){
15421543 // dipole moment of the excited state. It is needed that the dipole of ground state has been already calculated!!
1543-#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(auto)
1544+#pragma omp parallel for reduction(+:valueX,valueY,valueZ) schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
15441545 for(int l=0; l<this->matrixCISdimension; l++){
15451546 try{
15461547 double temp = 0.0;
@@ -1650,7 +1651,7 @@ void ZindoS::CalcOrbitalElectronPopulationCIS(double**** orbitalElectronPopulati
16501651 for(int k=0; k<elecStates->size(); k++){
16511652 int excitedStateIndex = (*elecStates)[k]-1;
16521653 stringstream ompErrors;
1653-#pragma omp parallel for schedule(auto)
1654+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
16541655 for(int mu=0; mu<molecule.GetTotalNumberAOs(); mu++){
16551656 try{
16561657 for(int nu=0; nu<molecule.GetTotalNumberAOs(); nu++){
@@ -1714,7 +1715,7 @@ void ZindoS::CalcAtomicElectronPopulationCIS(double*** atomicElectronPopulationC
17141715 // clac atomic electron population
17151716 for(int k=0; k<elecStates->size(); k++){
17161717 stringstream ompErrors;
1717-#pragma omp parallel for schedule(auto)
1718+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
17181719 for(int a=0; a<totalNumberAtoms; a++){
17191720 try{
17201721 int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex();
@@ -1760,7 +1761,7 @@ void ZindoS::CalcAtomicUnpairedPopulationCIS(double*** atomicUnpairedPopulationC
17601761 // calc atomic electron population
17611762 for(int k=0; k<elecStates->size(); k++){
17621763 stringstream ompErrors;
1763-#pragma omp parallel for schedule(auto)
1764+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
17641765 for(int a=0; a<totalNumberAtoms; a++){
17651766 try{
17661767 int firstAOIndex = molecule.GetAtom(a)->GetFirstAOIndex();
@@ -2099,7 +2100,7 @@ void ZindoS::CalcInteractionMatrix(double** interactionMatrix,
20992100 double const* const* expansionVectors,
21002101 int interactionMatrixDimension) const{
21012102 stringstream ompErrors;
2102-#pragma omp parallel for schedule(auto)
2103+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
21032104 for(int k=0; k<interactionMatrixDimension*interactionMatrixDimension; k++){
21042105 try{
21052106 int i = k/interactionMatrixDimension;
@@ -2363,7 +2364,7 @@ void ZindoS::CalcCISMatrix(double** matrixCIS) const{
23632364 // single excitation from I-th (occupied)MO to A-th (virtual)MO
23642365 int moI = this->GetActiveOccIndex(*this->molecule, k);
23652366 int moA = this->GetActiveVirIndex(*this->molecule, k);
2366-#pragma omp parallel for schedule(auto)
2367+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
23672368 for(int l=k; l<this->matrixCISdimension; l++){
23682369 try{
23692370 // single excitation from J-th (occupied)MO to B-th (virtual)MO
@@ -2731,7 +2732,7 @@ void ZindoS::CalcEtaMatrixForce(const vector<int>& elecStates){
27312732
27322733 // calc each element
27332734 stringstream ompErrors;
2734-#pragma omp parallel for schedule(auto)
2735+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
27352736 for(int mu=0; mu<numberAOs; mu++){
27362737 try{
27372738 for(int nu=0; nu<numberAOs; nu++){
@@ -2828,7 +2829,7 @@ void ZindoS::CalcZMatrixForce(const vector<int>& elecStates){
28282829 nonRedundantQIndeces.size());
28292830 // calculate each element of Z matrix.
28302831 stringstream ompErrors;
2831-#pragma omp parallel for schedule(auto)
2832+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
28322833 for(int mu=0; mu<this->molecule->GetTotalNumberAOs(); mu++){
28332834 try{
28342835 for(int nu=0; nu<this->molecule->GetTotalNumberAOs(); nu++){
@@ -2963,7 +2964,7 @@ void ZindoS::CalcDeltaVector(double* delta, int exciteState) const{
29632964 int numberActiveMO = numberActiveOcc + numberActiveVir;
29642965 MallocerFreer::GetInstance()->Initialize<double>(delta, numberActiveMO);
29652966 stringstream ompErrors;
2966-#pragma omp parallel for schedule(auto)
2967+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
29672968 for(int r=0; r<numberActiveMO; r++){
29682969 try{
29692970 double value = 0.0;
@@ -3044,7 +3045,7 @@ void ZindoS::CalcQVector(double* q,
30443045 int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2;
30453046 int numberActiveOcc = Parameters::GetInstance()->GetActiveOccCIS();
30463047 stringstream ompErrors;
3047-#pragma omp parallel for schedule(auto)
3048+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
30483049 for(int i=0; i<nonRedundantQIndeces.size(); i++){
30493050 try{
30503051 int moI = nonRedundantQIndeces[i].moI;
@@ -3074,7 +3075,7 @@ void ZindoS::CalcQVector(double* q,
30743075 if(!ompErrors.str().empty()){
30753076 throw MolDSException::Deserialize(ompErrors);
30763077 }
3077-#pragma omp parallel for schedule(auto)
3078+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
30783079 for(int i=0; i<redundantQIndeces.size(); i++){
30793080 try{
30803081 int r = nonRedundantQIndeces.size() + i;
@@ -3229,7 +3230,7 @@ void ZindoS::CalcXiMatrices(double** xiOcc,
32293230 xiVir, numberActiveVir, numberAOs);
32303231 stringstream ompErrors;
32313232 // xiOcc
3232-#pragma omp parallel for schedule(auto)
3233+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
32333234 for(int p=0; p<numberActiveOcc; p++){
32343235 try{
32353236 for(int mu=0; mu<numberAOs; mu++){
@@ -3251,7 +3252,7 @@ void ZindoS::CalcXiMatrices(double** xiOcc,
32513252 throw MolDSException::Deserialize(ompErrors);
32523253 }
32533254 // xiVir
3254-#pragma omp parallel for schedule(auto)
3255+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
32553256 for(int p=0; p<numberActiveVir; p++){
32563257 try{
32573258 for(int mu=0; mu<numberAOs; mu++){
@@ -3329,7 +3330,7 @@ void ZindoS::CalcGammaNRMinusKNRMatrix(double** gammaNRMinusKNR, const vector<Mo
33293330 if(mpiRank == calcRank){
33303331 int moI = nonRedundantQIndeces[i].moI;
33313332 int moJ = nonRedundantQIndeces[i].moJ;
3332-#pragma omp parallel for schedule(auto)
3333+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
33333334 for(int j=i; j<nonRedundantQIndecesSize; j++){
33343335 try{
33353336 int moK = nonRedundantQIndeces[j].moI;
@@ -3390,7 +3391,7 @@ void ZindoS::CalcKRDagerGammaRInvMatrix(double** kRDagerGammaRInv,
33903391 if(mpiRank == calcRank){
33913392 int moI = nonRedundantQIndeces[i].moI;
33923393 int moJ = nonRedundantQIndeces[i].moJ;
3393-#pragma omp parallel for schedule(auto)
3394+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
33943395 for(int j=0; j<redundantQIndecesSize; j++){
33953396 try{
33963397 int moK = redundantQIndeces[j].moI;
@@ -3686,7 +3687,7 @@ void ZindoS::CalcForce(const vector<int>& elecStates){
36863687 &tmpRotatedDiatomicOverlapVec,
36873688 &tmpMatrixBC,
36883689 &tmpVectorBC);
3689-#pragma omp for schedule(auto)
3690+#pragma omp for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
36903691 for(int b=0; b<this->molecule->GetNumberAtoms(); b++){
36913692 if(a == b){continue;}
36923693 const Atom& atomB = *molecule->GetAtom(b);
@@ -3845,7 +3846,7 @@ void ZindoS::CalcForce(const vector<int>& elecStates){
38453846 // First derivative of overlapAOs integral is
38463847 // calculated with GTO expansion technique.
38473848 stringstream ompErrors;
3848-#pragma omp parallel for schedule(auto)
3849+#pragma omp parallel for schedule(dynamic, MOLDS_OMP_DYNAMIC_CHUNK_SIZE)
38493850 for(int a=0; a<this->molecule->GetNumberAtoms(); a++){
38503851 try{
38513852 const Atom& atomA = *molecule->GetAtom(a);