Browse Source

Work on padding cells

master
Trevor Irons 5 years ago
parent
commit
ca9e920d1d
4 changed files with 60 additions and 47 deletions
  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 View File

7
 
7
 
8
 option ( LEMMA_MODULE_EMSCHUR3D TRUE )
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
 endif()
18
 endif()
16
 
19
 
17
 #find_package( PaSTiX )
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
 #    ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
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
 #  ei_add_property(EIGEN_TESTED_BACKENDS  "PaStiX, ")
46
 #  ei_add_property(EIGEN_TESTED_BACKENDS  "PaStiX, ")
44
-else()
47
+#else()
45
 #  ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")
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
 find_package( Umfpack )
58
 find_package( Umfpack )
87
 	#set (MKLLINK  "-L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -Wl,-rpath=$MKLROOT/lib/intel64")
89
 	#set (MKLLINK  "-L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -Wl,-rpath=$MKLROOT/lib/intel64")
88
         # OpenMP R3
90
         # OpenMP R3
89
         set (MKLLINK  "-L$MKLROOT/lib/intel64 -Wl,-rpath=$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread")
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
 		target_link_libraries(emschur3d "lemmacore" ${MKLLINK})
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
 	endif()
104
 	endif()
92
 
105
 
93
 	# Linking
106
 	# Linking

+ 1
- 0
examples/CMakeLists.txt View File

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

+ 5
- 5
examples/EMSchur3D.cpp View File

10
 /**
10
 /**
11
  * @file
11
  * @file
12
  * @date      01/04/2018 04:34:54 PM
12
  * @date      01/04/2018 04:34:54 PM
13
- * @version   $Id$
14
  * @author    Trevor Irons (ti)
13
  * @author    Trevor Irons (ti)
15
  * @email     tirons@egi.utah.edu
14
  * @email     tirons@egi.utah.edu
16
  * @copyright Copyright (c) 2018, University of Utah
15
  * @copyright Copyright (c) 2018, University of Utah
28
 
27
 
29
 int main( int argc, char** argv ) {
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
     //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
33
     //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
35
 
34
 
36
     // SUPERLU
35
     // SUPERLU
37
     //auto EM3D = EMSchur3D< Eigen::SuperLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
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
     //auto EM3D = EMSchur3D< Eigen::PardisoLDLT<Eigen::SparseMatrix<Complex, SPARSEMAJOR>, Eigen::Symmetric&Eigen::Lower > >::NewSP();
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
     //auto EM3D = EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
43
     //auto EM3D = EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, SPARSEMAJOR> > >::NewSP();
44
 
44
 
45
     // UmfPack
45
     // UmfPack

+ 4
- 5
include/EMSchur3D.h View File

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

Loading…
Cancel
Save