|
@@ -28,6 +28,15 @@
|
28
|
28
|
#ifdef HAVE_SUPERLU
|
29
|
29
|
#include "Eigen/SuperLUSupport"
|
30
|
30
|
#endif
|
|
31
|
+
|
|
32
|
+#ifdef HAVE_UMFPACK
|
|
33
|
+#include <Eigen/UmfPackSupport>
|
|
34
|
+#endif
|
|
35
|
+
|
|
36
|
+#ifdef HAVE_PASTIX
|
|
37
|
+#include <Eigen/PaStiXSupport>
|
|
38
|
+#endif
|
|
39
|
+
|
31
|
40
|
//#include "CSymSimplicialCholesky.h"
|
32
|
41
|
|
33
|
42
|
namespace Lemma {
|
|
@@ -361,10 +370,9 @@ namespace Lemma {
|
361
|
370
|
}
|
362
|
371
|
}
|
363
|
372
|
|
364
|
|
- #ifdef HAVE_SUPERLU
|
|
373
|
+#ifdef HAVE_SUPERLU
|
365
|
374
|
template<>
|
366
|
375
|
void EMSchur3D< Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > >::BuildCDirectSolver() {
|
367
|
|
-
|
368
|
376
|
CSolver = new Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > [Omegas.size()];
|
369
|
377
|
|
370
|
378
|
for (int iw=0; iw<Omegas.size(); ++iw) {
|
|
@@ -372,9 +380,10 @@ namespace Lemma {
|
372
|
380
|
timer.begin();
|
373
|
381
|
|
374
|
382
|
/* SuperLU */
|
375
|
|
- CSolver[iw].options().DiagPivotThresh = 0.0;
|
|
383
|
+ // Recommended values for symmetric mode
|
|
384
|
+ CSolver[iw].options().DiagPivotThresh = 0.01;
|
376
|
385
|
CSolver[iw].options().SymmetricMode = YES;
|
377
|
|
- //CSolver[iw].options().ColPerm = MMD_AT_PLUS_A;
|
|
386
|
+ CSolver[iw].options().ColPerm = MMD_AT_PLUS_A;
|
378
|
387
|
//CSolver[iw].options().Trans = NOTRANS;
|
379
|
388
|
//CSolver[iw].options().ConditionNumber = NO;
|
380
|
389
|
//std::cout << "SuperLU options:\n";
|
|
@@ -400,7 +409,7 @@ namespace Lemma {
|
400
|
409
|
|
401
|
410
|
}
|
402
|
411
|
}
|
403
|
|
- #endif
|
|
412
|
+#endif
|
404
|
413
|
|
405
|
414
|
template<>
|
406
|
415
|
void EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::COLAMDOrdering<int> > >::BuildCDirectSolver() {
|
|
@@ -429,6 +438,39 @@ namespace Lemma {
|
429
|
438
|
}
|
430
|
439
|
}
|
431
|
440
|
|
|
441
|
+#ifdef HAVE_UMFPACK
|
|
442
|
+ // Umfpack only seems to work when LOWER and UPPER are set to 1. Workarounds this have not been found.
|
|
443
|
+ template<>
|
|
444
|
+ void EMSchur3D< Eigen::UmfPackLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > >::BuildCDirectSolver() {
|
|
445
|
+ CSolver = new Eigen::UmfPackLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > [Omegas.size()];
|
|
446
|
+ for (int iw=0; iw<Omegas.size(); ++iw) {
|
|
447
|
+ jsw_timer timer;
|
|
448
|
+ timer.begin();
|
|
449
|
+ /* Complex system */
|
|
450
|
+ std::cout << "UmfPackLU pattern analyzing C_" << iw << ",";
|
|
451
|
+ std::cout.flush();
|
|
452
|
+
|
|
453
|
+ // Doesn't work, seg faults in solve
|
|
454
|
+ //Eigen::SparseMatrix<Complex> Csym = Cvec[iw].selfadjointView< Eigen::Lower >();
|
|
455
|
+
|
|
456
|
+ // Compiler errors get thrown with the view setting, good performance if LOWER and UPPER are set
|
|
457
|
+ // CSolver[iw].analyzePattern( Cvec[iw].selfadjointView< Eigen::Lower>() ); // Compiler error
|
|
458
|
+ CSolver[iw].analyzePattern( Cvec[iw] ); // requires LOWER=1 UPPER=1, double memory
|
|
459
|
+ // CSolver[iw].analyzePattern( Csym ); // seg faults
|
|
460
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
461
|
+
|
|
462
|
+ // factorize
|
|
463
|
+ timer.begin();
|
|
464
|
+ std::cout << "UmfPackLU factorising C_" << iw << ", ";
|
|
465
|
+ std::cout.flush();
|
|
466
|
+ // CSolver[iw].factorize( Cvec[iw].selfadjointView< Eigen::Lower>() );
|
|
467
|
+ CSolver[iw].factorize( Cvec[iw] );
|
|
468
|
+ // CSolver[iw].factorize( Csym );
|
|
469
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
470
|
+ }
|
|
471
|
+ }
|
|
472
|
+#endif
|
|
473
|
+
|
432
|
474
|
// template<>
|
433
|
475
|
// void EMSchur3D< Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
|
434
|
476
|
// CSolver = new Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > [Omegas.size()];
|
|
@@ -668,28 +710,33 @@ namespace Lemma {
|
668
|
710
|
// }
|
669
|
711
|
// }
|
670
|
712
|
//
|
671
|
|
-// template<>
|
672
|
|
-// void EMSchur3D< Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > > ::BuildCDirectSolver() {
|
673
|
|
-// CSolver = new Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > [Omegas.size()];
|
674
|
|
-// //MPI_Init(NULL, NULL);
|
675
|
|
-// for (int iw=0; iw<Omegas.size(); ++iw) {
|
676
|
|
-// Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
|
677
|
|
-// jsw_timer timer;
|
678
|
|
-// timer.begin();
|
679
|
|
-// /* Complex system */
|
680
|
|
-// std::cout << "PaStiX LU pattern analyzing C_" << iw << ",";
|
681
|
|
-// std::cout.flush();
|
682
|
|
-// CSolver[iw].compute( Csym );
|
683
|
|
-// std::cout << "PaStiX LU Done C_" << iw << std::endl;;
|
684
|
|
-// // std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
685
|
|
-// // // factorize
|
686
|
|
-// // timer.begin();
|
687
|
|
-// // std::cout << "PaStiX LU factorising C_" << iw << ", ";
|
688
|
|
-// // std::cout.flush();
|
689
|
|
-// // CSolver[iw].factorize( Csym );
|
690
|
|
-// // std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
691
|
|
-// }
|
692
|
|
-// }
|
|
713
|
+
|
|
714
|
+#ifdef HAVE_PASTIX
|
|
715
|
+ template<>
|
|
716
|
+ void EMSchur3D< Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > > ::BuildCDirectSolver() {
|
|
717
|
+ CSolver = new Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > [Omegas.size()];
|
|
718
|
+
|
|
719
|
+ for (int iw=0; iw<Omegas.size(); ++iw) {
|
|
720
|
+ jsw_timer timer;
|
|
721
|
+ timer.begin();
|
|
722
|
+ /* Complex system */
|
|
723
|
+ std::cout << "PastixLU pattern analyzing C_" << iw << ",";
|
|
724
|
+ std::cout.flush();
|
|
725
|
+ CSolver[iw].analyzePattern( Cvec[iw].selfadjointView< Eigen::Lower>() );
|
|
726
|
+ //CSolver[iw].analyzePattern( Cvec[iw] );
|
|
727
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
728
|
+
|
|
729
|
+ // factorize
|
|
730
|
+ timer.begin();
|
|
731
|
+ std::cout << "PastixLU factorising C_" << iw << ", ";
|
|
732
|
+ std::cout.flush();
|
|
733
|
+ CSolver[iw].factorize( Cvec[iw].selfadjointView< Eigen::Lower>() );
|
|
734
|
+ //CSolver[iw].factorize( Cvec[iw] );
|
|
735
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
736
|
+ }
|
|
737
|
+ }
|
|
738
|
+#endif
|
|
739
|
+
|
693
|
740
|
|
694
|
741
|
} // ----- end of Lemma name -----
|
695
|
742
|
|