Browse Source

Incrimental performance checks

master
Trevor Irons 5 years ago
parent
commit
096404cf52

+ 1
- 1
CMake/SuperBuild.cmake View File

23
     message( STATUS "YAML-CPP WAS NOT FOUND, BUILDING" )
23
     message( STATUS "YAML-CPP WAS NOT FOUND, BUILDING" )
24
     ExternalProject_Add(YAML_CPP
24
     ExternalProject_Add(YAML_CPP
25
         GIT_REPOSITORY  "https://github.com/jbeder/yaml-cpp.git"
25
         GIT_REPOSITORY  "https://github.com/jbeder/yaml-cpp.git"
26
-        GIT_TAG "master" # "yaml-cpp-0.6.2" # "master" 
26
+        GIT_TAG "master" # "yaml-cpp-0.6.2", # "master" 
27
         UPDATE_COMMAND ""
27
         UPDATE_COMMAND ""
28
         PATCH_COMMAND ""
28
         PATCH_COMMAND ""
29
         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
29
         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp

+ 4
- 0
CMakeLists.txt View File

332
 include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
332
 include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
333
 link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
333
 link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
334
 
334
 
335
+##############
336
+# gprof hack #
337
+##############
338
+#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
335
 
339
 
336
 ########################################################################
340
 ########################################################################
337
 # Build Modules
341
 # Build Modules

+ 12
- 14
Modules/FDEM1D/src/KernelEM1DReflSpec.cpp View File

19
 
19
 
20
         rams = lambda*lambda;
20
         rams = lambda*lambda;
21
         u = (rams-kk.array()).sqrt(); // CRITICAL
21
         u = (rams-kk.array()).sqrt(); // CRITICAL
22
+
22
         uk = u(0);
23
         uk = u(0);
23
         um = u(0);
24
         um = u(0);
24
 
25
 
27
 
28
 
28
         Zyd.tail<1>() = Zyi.tail<1>();
29
         Zyd.tail<1>() = Zyi.tail<1>();
29
 
30
 
30
-        // Vectorise, performance is not really any better
31
+        // Vectorise, performance benchmarks approx. the same as loop w gcc 9 -TI
31
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
32
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
32
         th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
33
         th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
33
 
34
 
34
-        /*
35
-        for (int ilay=1; ilay<nlay-1; ++ilay) {
36
-            cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
37
-            th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
38
-        }
39
-        */
35
+//         for (int ilay=1; ilay<nlay-1; ++ilay) {
36
+//             cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
37
+//             th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
38
+//         }
40
 
39
 
41
         // recursive, can't vectorize
40
         // recursive, can't vectorize
42
         for (int N=nlay-2; N >= 1; --N) {
41
         for (int N=nlay-2; N >= 1; --N) {
54
 
53
 
55
         rams = lambda*lambda;
54
         rams = lambda*lambda;
56
         u = (rams-kk.array()).sqrt(); // CRITICAL
55
         u = (rams-kk.array()).sqrt(); // CRITICAL
56
+
57
         uk = u(0);
57
         uk = u(0);
58
         um = u(0);
58
         um = u(0);
59
 
59
 
62
 
62
 
63
         Zyd.tail<1>() = Zyi.tail<1>();
63
         Zyd.tail<1>() = Zyi.tail<1>();
64
 
64
 
65
-        // Vectorise
65
+        // Vectorise, performance benchmarks approx. the same as loop w/ gcc 9 -TI
66
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
66
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
67
         th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
67
         th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
68
 
68
 
69
-        /*
70
-        for (int ilay=1; ilay<nlay-1; ++ilay) {
71
-            cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
72
-            th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
73
-        }
74
-        */
69
+//         for (int ilay=1; ilay<nlay-1; ++ilay) {
70
+//             cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
71
+//             th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
72
+//         }
75
 
73
 
76
         // recursive, can't vectorize
74
         // recursive, can't vectorize
77
         for (int N=nlay-2; N >=1; --N) {
75
         for (int N=nlay-2; N >=1; --N) {

+ 14
- 10
Modules/FDEM1D/testing/BenchKiHa.h View File

56
 		dipole->SetFrequency(0, 4400.1000);
56
 		dipole->SetFrequency(0, 4400.1000);
57
 		//dipole->SetPhase(0);
57
 		//dipole->SetPhase(0);
58
 		//dipole->SetLocation( (VectorXr(3) << 49, 49, -1e-4).finished() );
58
 		//dipole->SetLocation( (VectorXr(3) << 49, 49, -1e-4).finished() );
59
-		dipole->SetLocation( 0, 0, -1e-4  );
59
+		dipole->SetLocation( 0, 0, -1e-1  );
60
 
60
 
61
 	    // Define model
61
 	    // Define model
62
 	    VectorXcr sigma(8);
62
 	    VectorXcr sigma(8);
72
 	    receivers = FieldPoints::NewSP();
72
 	    receivers = FieldPoints::NewSP();
73
 		Vector3r loc;
73
 		Vector3r loc;
74
 
74
 
75
-        Real ox = 2.;
76
-		Real oy = 2.;
77
-		Real oz = 2;
75
+        Real ox = 250.;
76
+		Real oy = 250.;
77
+		Real oz = -250.;
78
 
78
 
79
-		Real dx = 0.62;
80
-		Real dy = 0.62;
81
-		Real dz = 0.62;
79
+		Real dx = 20;
80
+		Real dy = 20;
81
+		Real dz = 20;
82
 
82
 
83
-		int  nx = 20;
84
-		int  ny = 20;
85
-		int  nz = 20;
83
+		int  nx = 13;
84
+		int  ny = 13;
85
+		int  nz = 13;
86
         Delta = nx*ny*nz*1e-10;
86
         Delta = nx*ny*nz*1e-10;
87
 
87
 
88
 		receivers->SetNumberOfPoints(nx*ny*nz);
88
 		receivers->SetNumberOfPoints(nx*ny*nz);
118
 		dipole->SetPolarisation(ZPOLARISATION);
118
 		dipole->SetPolarisation(ZPOLARISATION);
119
 
119
 
120
         // Put in a unit test that will be slow.
120
         // Put in a unit test that will be slow.
121
+        std::cout << "MAGNETICDIPOLE Z polarisation" << std::endl;
121
 	    std::cout << "C++\n";
122
 	    std::cout << "C++\n";
122
 
123
 
123
   	    timer.begin();
124
   	    timer.begin();
153
 
154
 
154
         // Put in a unit test that will be slow.
155
         // Put in a unit test that will be slow.
155
 	    std::cout << "C++\n";
156
 	    std::cout << "C++\n";
157
+        std::cout << "MAGNETICDIPOLE X polarisation" << std::endl;
156
 
158
 
157
   	    timer.begin();
159
   	    timer.begin();
158
 	    EmEarth->MakeCalc3();
160
 	    EmEarth->MakeCalc3();
187
 
189
 
188
         // Put in a unit test that will be slow.
190
         // Put in a unit test that will be slow.
189
 	    std::cout << "C++\n";
191
 	    std::cout << "C++\n";
192
+        std::cout << "MAGNETICDIPOLE Y polarisation" << std::endl;
190
 
193
 
191
   	    timer.begin();
194
   	    timer.begin();
192
 	    EmEarth->MakeCalc3();
195
 	    EmEarth->MakeCalc3();
221
 
224
 
222
         // Put in a unit test that will be slow.
225
         // Put in a unit test that will be slow.
223
 	    std::cout << "C++\n";
226
 	    std::cout << "C++\n";
227
+        std::cout << "GROUNDEDELECTRICDIPOLE X polarisation" << std::endl;
224
 
228
 
225
   	    timer.begin();
229
   	    timer.begin();
226
 	    EmEarth->MakeCalc3();
230
 	    EmEarth->MakeCalc3();

Loading…
Cancel
Save