OpenMP - ProkopHapala/FireCore GitHub Wiki
Detailed info about CPU capabilities from:
cat /proc/cpuinfo
ouput like this:
processor : 11
vendor_id : GenuineIntel
cpu family : 6
model : 165
model name : Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
stepping : 3
microcode : 0xf4
cpu MHz : 2900.000
cache size : 12288 KB
physical id : 0
siblings : 12
core id : 5
cpu cores : 6
apicid : 11
initial apicid : 11
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit srbds mmio_stale_data retbleed eibrs_pbrsb
bogomips : 5799.77
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
Program structure is like this
// ToDo: OpenMP paraelization atempt
int run_omp( int niter, double dt, double Fconv, double Flim ){
int itr=0;
double F2conv = Fconv*Fconv;
double R2damp = Rdamp*Rdamp;
#pragma omp parallel default(shared)
for(int itr=0; itr<niter; itr++){
double E=0;
// ------ eval MMFF
#pragma omp for reduction(+:E)
for(int ia=0; ia<nnode; ia++){
E+=eval_atom(ia);
}
// ------ eval non-bond
#pragma omp for reduction(+:E)
for(int ia=0; ia<natoms; ia++){
E += evalLJQs_ng4_atom( ia, neighs, R2damp );
}
// ---- assemble (we need to wait when all atoms are evaluated)
#pragma omp for
for(int ia=0; ia<natoms; ia++){
assemble_atom( ia );
}
// ------ move
double F2=0;
#pragma omp for reduction(+:F2)
for(int i=0; i<nvecs; i++){
F2 += move_atom_GD( i, dt, Flim );
}
if(F2<F2conv)break;
}
return itr;
}
Test 1 - MMFF_lib with propandiol.xyz:
Results:
- Time 0.15 [s] Without OMP
- Time 0.50 [s] With
omp parallel for reduction(+:E)
- Time 1.50 [s] With
omp parallel for shared(E)
double eval_atoms(){
double E=0;
#pragma omp parallel for reduction(+:E)
for(int ia=0; ia<nnode; ia++){
E+=eval_atom(ia);
}
return E;
}
double evalLJQs_ng4_omp( const Quat4i* neighs, double Rdamp=1.0 ){
double R2damp = Rdamp*Rdamp;
double E =0;
##pragma omp parallel for reduction(+:E)
for(int i=0; i<n; i++){
E += evalLJQs_ng4_atom( i, neighs, R2damp );
}
return E;
}
test using python tMMFF/run_propandiol.py
damp_maxs = np.linspace( 0.05,0.3,50 )
T0 = time.time_ns()
for i,damp_max in enumerate(damp_maxs):
#mmff.setTrjName("trj_%03i.xyz" %i ,100)
mmff.DOFs [:,:] = apos_bak[:,:]
mmff.vDOFs[:,:] = 0
#mmff.set_opt( dt_max=0.1, dt_min=0.02, damp_max=0.2, finc=1.1, fdec=0.5, falpha=0.8, minLastNeg=5, cvf_min=-0.1, cvf_max=+0.1 )
mmff.set_opt( damp_max=damp_max )
ns[i] = mmff.run(nmaxiter, ialg=ialg )
T=time.time_ns()-T0; print( "Time ", T*1.e-9, "[s]" )
system propandiol.xyz
13
XYZ file generated by Avogadro.
C -2.36974 1.65534 -0.46512
C -1.17367 0.99047 0.25572
H -2.01772 2.40332 -1.18124
O -3.18096 0.68061 -1.12917
H -2.99066 2.15989 0.27968
C 0.13615 1.04693 -0.55996
H -1.00475 1.51583 1.19851
H -1.40981 -0.04581 0.51263
H 0.38236 2.08449 -0.80237
H 0.94772 0.63249 0.04452
O 0.02509 0.28621 -1.76371
H -2.65350 0.21443 -1.80282
H -0.39081 0.84571 -2.44243
NOTES: