Parcourir la source

Work on padding cells

master
Trevor Irons il y a 5 ans
Parent
révision
ca9e920d1d
4 fichiers modifiés avec 60 ajouts et 47 suppressions
  1. 50
    37
      CMakeLists.txt
  2. 1
    0
      examples/CMakeLists.txt
  3. 5
    5
      examples/EMSchur3D.cpp
  4. 4
    5
      include/EMSchur3D.h

+ 50
- 37
CMakeLists.txt Voir le fichier

@@ -7,50 +7,52 @@ set(EMSCHUR3D_VERSION_NOQUOTES "${EMSCHUR3D_VERSION_MAJOR}.${EMSCHUR3D_VERSION_M
7 7
 
8 8
 option ( LEMMA_MODULE_EMSCHUR3D TRUE )
9 9
 
10
-find_package( SuperLU )
11
-if (SUPERLU_FOUND)
12
-	message( STATUS "SuperLU was found" )
13
-	add_compile_options(-DHAVE_SUPERLU)
14
-	INCLUDE_DIRECTORIES(${SUPERLU_INCLUDES})
10
+option ( LEMMA_USE_SUPERLU FALSE)
11
+if (LEMMA_USE_SUPERLU)
12
+	find_package( SuperLU )
13
+	if (SUPERLU_FOUND)
14
+		message( STATUS "SuperLU was found" )
15
+		add_compile_options(-DHAVE_SUPERLU)
16
+		INCLUDE_DIRECTORIES(${SUPERLU_INCLUDES})
17
+	endif()
15 18
 endif()
16 19
 
17 20
 #find_package( PaSTiX )
18
-find_package( PaSTiX COMPONENTS METIS SEQ )
19
-
20
-find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS
21
-  #NAMES pastix/nompi.h
22
-  NAMES pastix_nompi.h
23
-  HINTS ${PASTIX_INCLUDE_DIRS}
24
-)
25
-if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS)
26
-  message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory."
27
-                 " Because Eigen tests require a version without MPI, we disable the Pastix backend.")
28
-endif()
29
-if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS)
30
-  add_definitions("-DEIGEN_PASTIX_SUPPORT")
31
-  include_directories(${PASTIX_INCLUDE_DIRS_DEP})
32
-  if(SCOTCH_FOUND)
33
-    include_directories(${SCOTCH_INCLUDE_DIRS})
34
-    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
35
-  elseif(METIS_FOUND)
36
-    include_directories(${METIS_INCLUDE_DIRS})
37
-    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
38
-  else(SCOTCH_FOUND)
21
+#find_package( PaSTiX COMPONENTS METIS SEQ )
22
+
23
+#find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS
24
+#  #NAMES pastix/nompi.h
25
+#  NAMES pastix_nompi.h
26
+#  HINTS ${PASTIX_INCLUDE_DIRS}
27
+#)
28
+#if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS)
29
+#  message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory."
30
+#                 " Because Eigen tests require a version without MPI, we disable the Pastix backend.")
31
+#endif()
32
+#if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS)
33
+#  add_definitions("-DEIGEN_PASTIX_SUPPORT")
34
+#  include_directories(${PASTIX_INCLUDE_DIRS_DEP})
35
+#  if(SCOTCH_FOUND)
36
+#    include_directories(${SCOTCH_INCLUDE_DIRS})
37
+#    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
38
+#  elseif(METIS_FOUND)
39
+#    include_directories(${METIS_INCLUDE_DIRS})
40
+#    set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
41
+#  else(SCOTCH_FOUND)
39 42
 #    ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
40
-  endif(SCOTCH_FOUND)
41
-  set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES})
42
-  set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP})
43
+#  endif(SCOTCH_FOUND)
44
+#  set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES})
45
+#  set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP})
43 46
 #  ei_add_property(EIGEN_TESTED_BACKENDS  "PaStiX, ")
44
-else()
47
+#else()
45 48
 #  ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
46
-endif()
47
-
48
-if ( PASTIX_FOUND )
49
-	message( STATUS "PaSTiX was found" )
50
-	add_compile_options(-DHAVE_PASTIX)
51
-	INCLUDE_DIRECTORIES(${PASTIX_INCLUDES})
52
-endif()
49
+#endif()
53 50
 
51
+#if ( PASTIX_FOUND )
52
+#	message( STATUS "PaSTiX was found" )
53
+#	add_compile_options(-DHAVE_PASTIX)
54
+#	INCLUDE_DIRECTORIES(${PASTIX_INCLUDES})
55
+#endif()
54 56
 
55 57
 
56 58
 find_package( Umfpack )
@@ -87,7 +89,18 @@ if ( LEMMA_VTK6_SUPPORT OR LEMMA_VTK7_SUPPORT OR LEMMA_VTK8_SUPPORT AND LEMMA_MO
87 89
 	#set (MKLLINK  "-L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -Wl,-rpath=$MKLROOT/lib/intel64")
88 90
         # OpenMP R3
89 91
         set (MKLLINK  "-L$MKLROOT/lib/intel64 -Wl,-rpath=$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread")
92
+		add_compile_options( -DEIGEN_USE_MKL_ALL )
90 93
 		target_link_libraries(emschur3d "lemmacore" ${MKLLINK})
94
+	else()
95
+		find_library( PARDISO600 
96
+            NAMES pardiso600 libpardiso600.so libpardiso600-GNU800-X86-64.so 
97
+        	HINTS $(CMAKE_INSTALL_PREFIX)
98
+			PATH_SUFFIXES lib
99
+        )
100
+		if (PARDISO600)
101
+			add_compile_options(-DHAVE_PARDISO -mkl) # -mkl ONLY WORKS WITH INTEL, but academic pardiso doesn't include headers...
102
+			target_link_libraries( emschur3d "lemmacore" )
103
+		endif()
91 104
 	endif()
92 105
 
93 106
 	# Linking

+ 1
- 0
examples/CMakeLists.txt Voir le fichier

@@ -15,6 +15,7 @@ install ( DIRECTORY mod  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ )
15 15
 install ( DIRECTORY grd  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ ) 
16 16
 install ( DIRECTORY src  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ ) 
17 17
 install ( FILES block.sh  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ ) 
18
+install ( FILES block2.sh  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ ) 
18 19
 install ( FILES block.py  DESTINATION ${CMAKE_INSTALL_PREFIX}/share/EMSchur3D/ ) 
19 20
 
20 21
 INSTALL_TARGETS( "/share/EMSchur3D/"

+ 5
- 5
examples/EMSchur3D.cpp Voir le fichier

@@ -10,7 +10,6 @@
10 10
 /**
11 11
  * @file
12 12
  * @date      01/04/2018 04:34:54 PM
13
- * @version   $Id$
14 13
  * @author    Trevor Irons (ti)
15 14
  * @email     tirons@egi.utah.edu
16 15
  * @copyright Copyright (c) 2018, University of Utah
@@ -28,18 +27,19 @@ using namespace Lemma;
28 27
 
29 28
 int main( int argc, char** argv ) {
30 29
 
31
-    // BiCGSTAB Diagonal preconditioner
32
-    auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR>, Eigen::IncompleteLUT<Complex> > >::NewSP();
30
+    // BiCGSTAB ILU preconditioner
31
+    //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR>, Eigen::IncompleteLUT<Complex> > >::NewSP();
33 32
 
34 33
     //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
35 34
 
36 35
     // SUPERLU
37 36
     //auto EM3D = EMSchur3D< Eigen::SuperLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
38 37
 
39
-    //auto EM3D = EMSchur3D< Eigen::PardisoLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
38
+    // Pardiso
39
+    auto EM3D = EMSchur3D< Eigen::PardisoLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
40 40
     //auto EM3D = EMSchur3D< Eigen::PardisoLDLT<Eigen::SparseMatrix<Complex, SPARSEMAJOR>, Eigen::Symmetric&Eigen::Lower > >::NewSP();
41 41
 
42
-    // Eigen built-in
42
+    // Eigen LU
43 43
     //auto EM3D = EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
44 44
 
45 45
     // UmfPack

+ 4
- 5
include/EMSchur3D.h Voir le fichier

@@ -10,7 +10,6 @@
10 10
 /**
11 11
  * @file
12 12
  * @date      02/19/2015 01:10:39 PM
13
- * @version   $Id$
14 13
  * @author    Trevor Irons (ti)
15 14
  * @email     Trevor.Irons@Lemmasoftware.org
16 15
  * @copyright Copyright (c) 2015, XRI Geophysics, LLC
@@ -282,7 +281,6 @@ namespace Lemma {
282 281
 
283 282
 
284 283
         /* Restart if necessary */
285
-/*
286 284
         int nrestart(1);
287 285
         // TODO send MAC to implicitbicgstab?
288 286
         while (success == 2 && nrestart < 18 && iter_done > 1) {
@@ -290,7 +288,6 @@ namespace Lemma {
290 288
             //Phi.array() *= MAC.array().cast<Complex>(); // remove phi from air regions
291 289
             nrestart += 1;
292 290
         }
293
-*/
294 291
 
295 292
         logio << "Implicit BiCGStab solution in " << iter_done << " iterations."
296 293
                 << " with error " << std::setprecision(8) << std::scientific << errorn << std::endl;
@@ -478,14 +475,16 @@ namespace Lemma {
478 475
             /*  Complex system */
479 476
             std::cout << "PardisoLU pattern analyzing C_" << iw << ",";
480 477
             std::cout.flush();
481
-            CSolver[iw].analyzePattern( Cvec[iw].selfadjointView< Eigen::Lower>() );
478
+            //CSolver[iw].analyzePattern( Cvec[iw].selfadjointView< Eigen::Lower>() );
479
+            CSolver[iw].analyzePattern( Cvec[iw] );
482 480
             std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
483 481
 
484 482
             // factorize
485 483
             timer.begin();
486 484
             std::cout << "PardisoLU factorising C_" << iw << ", ";
487 485
             std::cout.flush();
488
-            CSolver[iw].factorize( Cvec[iw].selfadjointView< Eigen::Lower>() );
486
+            //CSolver[iw].factorize( Cvec[iw].selfadjointView< Eigen::Lower>() );
487
+            CSolver[iw].factorize( Cvec[iw] );
489 488
             std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
490 489
         }
491 490
     }

Chargement…
Annuler
Enregistrer