Quellcode durchsuchen

Incrimental performance checks

master
Trevor Irons vor 5 Jahren
Ursprung
Commit
096404cf52

+ 1
- 1
CMake/SuperBuild.cmake Datei anzeigen

@@ -23,7 +23,7 @@ else()
23 23
     message( STATUS "YAML-CPP WAS NOT FOUND, BUILDING" )
24 24
     ExternalProject_Add(YAML_CPP
25 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 27
         UPDATE_COMMAND ""
28 28
         PATCH_COMMAND ""
29 29
         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp

+ 4
- 0
CMakeLists.txt Datei anzeigen

@@ -332,6 +332,10 @@ include_directories("${PROJECT_BINARY_DIR}/include")
332 332
 include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
333 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 341
 # Build Modules

+ 12
- 14
Modules/FDEM1D/src/KernelEM1DReflSpec.cpp Datei anzeigen

@@ -19,6 +19,7 @@ namespace Lemma {
19 19
 
20 20
         rams = lambda*lambda;
21 21
         u = (rams-kk.array()).sqrt(); // CRITICAL
22
+
22 23
         uk = u(0);
23 24
         um = u(0);
24 25
 
@@ -27,16 +28,14 @@ namespace Lemma {
27 28
 
28 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 32
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
32 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 40
         // recursive, can't vectorize
42 41
         for (int N=nlay-2; N >= 1; --N) {
@@ -54,6 +53,7 @@ namespace Lemma {
54 53
 
55 54
         rams = lambda*lambda;
56 55
         u = (rams-kk.array()).sqrt(); // CRITICAL
56
+
57 57
         uk = u(0);
58 58
         um = u(0);
59 59
 
@@ -62,16 +62,14 @@ namespace Lemma {
62 62
 
63 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 66
         cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
67 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 74
         // recursive, can't vectorize
77 75
         for (int N=nlay-2; N >=1; --N) {

+ 14
- 10
Modules/FDEM1D/testing/BenchKiHa.h Datei anzeigen

@@ -56,7 +56,7 @@ public:
56 56
 		dipole->SetFrequency(0, 4400.1000);
57 57
 		//dipole->SetPhase(0);
58 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 61
 	    // Define model
62 62
 	    VectorXcr sigma(8);
@@ -72,17 +72,17 @@ public:
72 72
 	    receivers = FieldPoints::NewSP();
73 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 86
         Delta = nx*ny*nz*1e-10;
87 87
 
88 88
 		receivers->SetNumberOfPoints(nx*ny*nz);
@@ -118,6 +118,7 @@ public:
118 118
 		dipole->SetPolarisation(ZPOLARISATION);
119 119
 
120 120
         // Put in a unit test that will be slow.
121
+        std::cout << "MAGNETICDIPOLE Z polarisation" << std::endl;
121 122
 	    std::cout << "C++\n";
122 123
 
123 124
   	    timer.begin();
@@ -153,6 +154,7 @@ public:
153 154
 
154 155
         // Put in a unit test that will be slow.
155 156
 	    std::cout << "C++\n";
157
+        std::cout << "MAGNETICDIPOLE X polarisation" << std::endl;
156 158
 
157 159
   	    timer.begin();
158 160
 	    EmEarth->MakeCalc3();
@@ -187,6 +189,7 @@ public:
187 189
 
188 190
         // Put in a unit test that will be slow.
189 191
 	    std::cout << "C++\n";
192
+        std::cout << "MAGNETICDIPOLE Y polarisation" << std::endl;
190 193
 
191 194
   	    timer.begin();
192 195
 	    EmEarth->MakeCalc3();
@@ -221,6 +224,7 @@ public:
221 224
 
222 225
         // Put in a unit test that will be slow.
223 226
 	    std::cout << "C++\n";
227
+        std::cout << "GROUNDEDELECTRICDIPOLE X polarisation" << std::endl;
224 228
 
225 229
   	    timer.begin();
226 230
 	    EmEarth->MakeCalc3();

Laden…
Abbrechen
Speichern