forked from primme/primme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.txt
8391 lines (5652 loc) · 276 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Note:
For hyperlinked html and pdf versions of this document see directory
"doc".
PRIMME Documentation
********************
Table Of Contents:
* PRIMME: PReconditioned Iterative MultiMethod Eigensolver
* Incompatibilities
* Changelog
* License Information
* Citing the code
* Contact Information
* Support
* Directory Structure
* Making and Linking
* Tested Systems
* Main Contributors
* Eigenvalue Problems
* C Library Interface
* FORTRAN 77 Library Interface
* FORTRAN 90 Library Interface
* Python Interface
* MATLAB Interface
* Parameters Description
* Preset Methods
* Error Codes
* Singular Value Problems
* C Library Interface
* FORTRAN Library Interface
* FORTRAN 90 Library Interface
* Python Interface
* MATLAB Interface
* Parameter Description
* Preset Methods
* Error Codes
PRIMME: PReconditioned Iterative MultiMethod Eigensolver
********************************************************
PRIMME, pronounced as *prime*, is a high-performance library for
computing a few eigenvalues/eigenvectors, and singular values/vectors.
PRIMME is especially optimized for large, difficult problems. Real
symmetric and complex Hermitian problems, standard A x = \lambda x and
generalized A x = \lambda B x, are supported. Besides standard
eigenvalue problems with a normal matrix are supported. It can find
largest, smallest, or interior singular/eigenvalues, and can use
preconditioning to accelerate convergence. PRIMME is written in C99,
but complete interfaces are provided for Fortran, MATLAB, Python, and
R.
Incompatibilities
=================
From PRIMME 2.2 to 3.0:
* Removed constants "primme_thick" and "primme_dtr", and the member
"scheme" from "restarting_params".
* Added members "numBroadcast", "volumeBroadcast", "flopsDense",
"timeBroadcast", "timeDense", "estimateBNorm", "estimateInvBNorm",
and "lockingIssue" to "primme_stats".
* Added members "matrixMatvec_type", "applyPreconditioner_type",
"massMatrixMatvec_type", "globalSumReal_type", "broadcastReal",
"broadcastReal_type", "BNorm", "invBNorm", "orth",
"internalPrecision", "massMatrix", "convTestFun_type",
"monitorFun_type", "queue", and "profile" to "primme_params".
* Added members "matrixMatvec_type", "applyPreconditioner_type",
"globalSumReal_type", "broadcastReal", "broadcastReal_type",
"internalPrecision", "convTestFun_type", "monitorFun_type", "queue",
and "profile" to "primme_svds_params".
* Changed callbacks "monitorFun" and "monitorFun".
* Changed the value of all constants; see "primme_get_member_f77()",
"primme_set_member_f77()", "primme_svds_get_member_f77()", and
"primme_svds_set_member_f77()".
* Removed "intWorkSize", "realWorkSize", "intWork", "realWork" from
"primme_params" and "primme_svds_params".
From PRIMME 2.0 to 2.1:
* Added members "monitorFun" and "monitor" to "primme_params".
* Added members "monitorFun" and "monitor" to "primme_svds_params".
* Renamed "PRIMME_SUBSPACE_ITERATION" as "PRIMME_STEEPEST_DESCENT".
From PRIMME 1.x to 2.0:
* Prototype of callbacks has changed: "matrixMatvec",
"applyPreconditioner", "massMatrixMatvec" and "globalSumReal".
* The next parameters are "PRIMME_INT": "n", "nLocal", "maxMatvecs",
"iseed", "numOuterIterations", "numRestarts", "numMatvecs" and
"numMatvecs"; use the macro "PRIMME_INT_P" to print the values.
* Rename the values of the enum "primme_preset_method".
* Rename "primme_Free" to "primme_free()".
* Integer parameters in Fortran functions are of the same size as
"PRIMME_INT", which is "integer*8" by default.
* Extra parameter in many Fortran functions to return the error code.
* Removed "primme_display_stats_f77".
Changelog
=========
Changes in PRIMME 3.2 (released on Jan 29, 2021):
* Fixed Intel 2021 compiler error ""Unsupported combination of types
for <tgmath.h>.""
* Fixed compiling issues with PGI compiler also about "tgmath.h".
* Fixed "dprimme()" and other variants not returning error code
*PRIMME_MAIN_ITER_FAILURE* when it should do in some corner cases.
* Fixed warnings from gcc/clang undefined behavior sanitizers.
* Matlab: renamed *disp* to *reportLevel*.
* Matlab: add flag *returnUnconverged* to return unconverged pairs
optionally.
* Matlab: return primme_params/primme_svds_params.
Changes in PRIMME 3.1 (released on May 2, 2020):
* Fixed compilation issues in F90 interface and examples.
* Fixed bug in block orthogonalization.
* Updated Python interface to Python version 3.8.
Changes in PRIMME 3.0 (released on December 14, 2019):
* Added support for the generalized Hermitian eigenvalue problem (see
"massMatrixMatvec") and the standard normal eigenvalue problem (see
"zprimme_normal()").
* Added support for GPU (see "magma_dprimme()",
"magma_zprimme_normal()", and "magma_dprimme_svds()").
* Added support for half precision (see "hprimme()" and "kprimme()",
and other variants for normal eigenproblems and singular value
problems).
* Added block orthogonalization (see "orth").
* Resolution of all linear system of equations simultaneously in
Jacobi-Davidson.
* Added interface for Fortran 90.
* Added an optional callback for broadcasting (see "broadcastReal" and
"broadcastReal").
* The callbacks can work with different precision than the main call
(see for instance "matrixMatvec_type" and "globalSumReal_type").
* Added new counters: "numGlobalSum", "volumeGlobalSum",
"numBroadcast", "volumeGlobalSum", "timeOrtho", "timeGlobalSum",
"timeBroadcast".
* Added "primme_params_create()", "primme_params_destroy()",
"primme_svds_params_create()", and "primme_svds_params_destroy()".
Changes in PRIMME 2.2 (released on October 26, 2018):
* Improved stability for single precision.
* Improved support for the shared library.
* Updated PETSc examples in Fortran; added new examples in single
precision.
* Improved support for FreeBSD and MacOS.
* New install and uninstall actions.
* MATLAB interface support for user-defined stopping criterion (see
"convTestFun" and "convTestFun") and stopping with ctr+c.
* Optional suffix on BLAS/LAPACK function names (for OpenBLAS, see
PRIMME_BLAS_SUFFIX).
* Replaced XHEGV by XHEGVX (to support ESSL).
* Fixed bugs in the library and in the Matlab interface.
Changes in PRIMME 2.1 (released on April 4, 2017):
* Improved robustness by broadcasting the result of critical LAPACK
operations instead of replicating them on every process; this is
useful when using a threaded BLAS/LAPACK or when some parallel
processes may run on different architectures or libraries.
* New stopping criteria in QMR that improve performance for interior
problems.
* MATLAB interface reimplementation with support for singular value
problems, "primme_svds()", with double and single precision, and
compatible with Octave.
* R interface
* Proper reporting of convergence history for singular value solvers.
Changes in PRIMME 2.0 (released on September 19, 2016):
* Changed license to BSD 3-clause.
* New support for singular value problems; see "dprimme_svds()".
* New support for "float" and "complex float" arithmetic.
* Support for problem dimensions larger than 2^31, without requiring
BLAS and LAPACK compiled with 64-bits integers.
* Improve robustness and performance for interior problems;
implemented advanced refined and harmonic-Ritz extractions.
* Python interface compatible with NumPy and SciPy Library.
* Added parameter to indicate the leading dimension of the
input/output matrices and to return an error code in callbacks
"matrixMatvec", "applyPreconditioner", "massMatrixMatvec" and
"globalSumReal".
* Changed to type "PRIMME_INT" the options "n", "nLocal", "maxMatvecs"
and "iseed", and the stats counters "numOuterIterations",
"numRestarts", "numMatvecs", "numPreconds". Also changed
"realWorkSize" to "size_t". Fortran interface functions will expect
an "interger" of size compatible with "PRIMME_INT" for all
parameters with integer type: "int", "PRIMME_INT" and "size_t"; see
also parameter "value" in functions "primmetop_set_member_f77()",
"primmetop_get_member_f77()", "primme_set_member_f77()" and
"primme_get_member_f77()".
* Added parameter to return an error code in Fortran interface
functions: "primmetop_set_member_f77()",
"primmetop_get_member_f77()", "primme_set_member_f77()" and
"primme_get_member_f77()".
* Added leading dimension for "evecs" "ldevecs" and preferred leading
dimension for the operators "ldOPs", such as "matrixMatvec".
* Optional user-defined convergence function, "convTestFun".
* Prefixed methods with "PRIMME_". Rename Fortran constants from
"PRIMMEF77_" to "PRIMME_".
* Removed "primme_display_stats_f77".
Changes in PRIMME 1.2.2 (released on October 13, 2015):
* Fixed wrong symbols in "libdprimme.a" and "libzprimme.a".
* "primme_set_method()" sets "PRIMME_JDQMR" instead of
"PRIMME_JDQMR_ETol" for preset methods "PRIMME_DEFAULT_MIN_TIME" and
"PRIMME_DYNAMIC" when seeking interior values.
* Fixed compilation of driver with a PETSc installation without HYPRE.
* Included the content of the environment variable "INCLUDE" for
compiling the driver.
Changes in PRIMME 1.2.1 (released on September 7, 2015):
* Added MATLAB interface to full PRIMME functionality.
* Support for BLAS/LAPACK with 64bits integers
("-DPRIMME_BLASINT_SIZE=64").
* Simplified configuration of Make_flags and Make_links (removed "TOP"
variable and replaced defines "NUM_SUM" and "NUM_IBM" by
"F77UNDERSCORE").
* Replaced directories "DTEST" and "ZTEST" by "TEST", that has:
* "driver.c": read matrices in MatrixMarket format and PETSc binary
and call PRIMME with the parameters specified in a file; support
complex arithmetic and MPI and can use PETSc preconditioners.
* "ex*.c" and "ex*.f": small, didactic examples of usage in C and
Fortran and in parallel (with PETSc).
* Fixed a few minor bugs and improved documentation (especially the
F77 interface).
* Using Sphinx to manage documentation.
Changes in PRIMME 1.2 (released on December 21, 2014):
* A Fortran compiler is no longer required for building the PRIMME
library. Fortran programs can still be linked to PRIMME’s F77
interface.
* Fixed some uncommon issues with the F77 interface.
* PRIMME can be called now multiple times from the same program.
* Performance improvements in the QMR inner solver, especially for
complex arithmetic.
* Fixed a couple of bugs with the locking functionality.
* In certain extreme cases where all eigenvalues of a matrix were
needed.
* The order of selecting interior eigenvalues.
The above fixes have improved robustness and performance.
* PRIMME now assigns unique random seeds per parallel process for up
to 4096^3 (140 trillion) processes.
* For the "PRIMME_DYNAMIC" method, fixed issues with initialization
and synchronization decisions across multiple processes.
* Fixed uncommon library interface bugs, coordinated better setting
the method and the user setting of parameters, and improved the
interface in the sample programs and makefiles.
* Other performance and documentation improvements.
License Information
===================
PRIMME is licensed under the 3-clause license BSD. Python and MATLAB
interfaces have BSD-compatible licenses. Source code under "tests" is
compatible with LGPLv3. Details can be taken from "COPYING.txt":
Copyright (c) 2018, College of William & Mary
All rights reserved.
Citing the code
===============
Please cite (find the BibTeX in "doc/primme.doc"):
[r1] A. Stathopoulos and J. R. McCombs PRIMME: *PReconditioned
Iterative MultiMethod Eigensolver: Methods and software
description*, ACM Transaction on Mathematical Software Vol. 37,
No. 2, (2010), 21:1-21:30.
[r6] L. Wu, E. Romero and A. Stathopoulos, *PRIMME_SVDS: A High-
Performance Preconditioned SVD Solver for Accurate Large-Scale
Computations*, J. Sci. Comput., Vol. 39, No. 5, (2017),
S248–S271.
More information on the algorithms and research that led to this
software can be found in the rest of the papers. The work has been
supported by a number of grants from the National Science Foundation.
[r2] A. Stathopoulos, *Nearly optimal preconditioned methods for
Hermitian eigenproblems under limited memory. Part I: Seeking one
eigenvalue*, SIAM J. Sci. Comput., Vol. 29, No. 2, (2007),
481–514.
[r3] A. Stathopoulos and J. R. McCombs, *Nearly optimal preconditioned
methods for Hermitian eigenproblems under limited memory. Part
II: Seeking many eigenvalues*, SIAM J. Sci. Comput., Vol. 29, No.
5, (2007), 2162-2188.
[r4] J. R. McCombs and A. Stathopoulos, *Iterative Validation of
Eigensolvers: A Scheme for Improving the Reliability of Hermitian
Eigenvalue Solvers*, SIAM J. Sci. Comput., Vol. 28, No. 6,
(2006), 2337-2358.
[r5] A. Stathopoulos, *Locking issues for finding a large number of
eigenvectors of Hermitian matrices*, Tech Report: WM-CS-2005-03,
July, 2005.
[r7] L. Wu and A. Stathopoulos, *A Preconditioned Hybrid SVD Method
for Computing Accurately Singular Triplets of Large Matrices*,
SIAM J. Sci. Comput. 37-5(2015), pp. S365-S388.
Contact Information
===================
For reporting bugs or questions about functionality contact Andreas
Stathopoulos by email, *andreas* at *cs.wm.edu*. See further
information in the webpage http://www.cs.wm.edu/~andreas/software and
on github.
Support
=======
* National Science Foundation through grants CCF 1218349, ACI SI2-SSE
1440700, and NSCI 1835821
* Department of Energy through grant Exascale Computing Project
17-SC-20-SC
Directory Structure
===================
The next directories and files should be available:
* "COPYING.txt", license;
* "Make_flags", flags to be used by makefiles to compile library and
tests;
* "Link_flags", flags needed in making and linking the test programs;
* "include/", directory with headers files;
* "src/", directory with the source code for "libprimme":
* "include/", common headers;
* "eigs/", eigenvalue interface and implementation;
* "svds/", singular value interface and implementation;
* "tools/", tools used to generated some headers;
* "Matlab/", MATLAB interface;
* "Python/", Python interface;
* "examples/", sample programs in C, C++ and F77, both sequential
and parallel;
* "tests/", drivers for testing purpose and test cases;
* "lib/libprimme.a", the PRIMME library (to be made);
* "makefile" main make file;
* "readme.txt" text version of the documentation;
* "doc/" directory with the HTML and PDF versions of the
documentation.
Making and Linking
==================
"Make_flags" has the flags and compilers used to make "libprimme.a":
* *CC*, compiler program such as "gcc", "clang" or "icc".
* *CFLAGS*, compiler options such as "-g" or "-O3" and macro
definitions
like the ones described next.
Compiler flags for the BLAS and LAPACK libraries:
* "-DF77UNDERSCORE", if Fortran appends an underscore to function
names (usually it does).
* "-DPRIMME_BLASINT_SIZE=64", if the library integers are 64-bit
integer ("kind=8") type, aka ILP64 interface; usually integers are
32-bits even in 64-bit architectures (aka LP64 interface).
* "-DPRIMME_BLAS_SUFFIX=<suffix>", set a suffix to BLAS/LAPACK
function names; for instance, OpenBlas compiled with ILP64 may
append "_64" to the function names.
By default PRIMME sets the integer type for matrix dimensions and
counters ("PRIMME_INT") to 64 bits integer "int64_t". This can be
changed by setting the macro "PRIMME_INT_SIZE" to one of the following
values:
* "0": use the regular "int" of your compiler.
* "32": use C99 "int32_t".
* "64": use C99 "int64_t".
Note:
When "-DPRIMME_BLASINT_SIZE=64" is set the code uses the type
"int64_t" supported by the C99 standard. In case the compiler
doesn’t honor the standard, you can set the corresponding type name
supported, for instance "-DPRIMME_BLASINT_SIZE=__int64".
After customizing "Make_flags", type this to generate "libprimme.a":
make lib
Making can be also done at the command line:
make lib CC=clang CFLAGS='-O3'
"Link_flags" has the flags for linking with external libraries and
making the executables located in "examples" and "tests":
* *LDFLAGS*, linker flags such as "-framework Accelerate".
* *LIBS*, flags to link with libraries (BLAS and LAPACK are required),
such as "-lprimme -llapack -lblas -lgfortran -lm".
After that, type this to compile and execute a simple test:
$ make test
...
Test passed!
...
Test passed!
In case of linking problems check flags in *LDFLAGS* and *LIBS* and
consider to add/remove "-DF77UNDERSCORE" from *CFLAGS*. If the
execution fails consider to add/remove "-DPRIMME_BLASINT_SIZE=64" from
*CFLAGS*.
Full description of actions that *make* can take:
* *make lib*, builds the static library "libprimme.a".
* *make solib*, builds the shared library "libprimme.so".
* *make install*, installs header files and the static and dynamic
libraries.
* *make uninstall*, uninstalls header files and the static and dynamic
libraries.
* *make matlab*, builds *libprimme.a* compatible with MATLAB and the
MATLAB module.
* *make octave*, builds *libprimme.a* and the Octave module.
* *make python*, builds *libprimme.a* and the Python module.
* *make python_install*, install the Python module.
* *make R_install*, builds and installs the R package.
* *make test*, build and execute simple examples.
* *make clean*, removes all "*.o", "a.out", and core files from "src".
Considerations using an IDE
---------------------------
PRIMME can be built in other environments such as Anjuta, Eclipse,
KDevelop, Qt Creator, Visual Studio and XCode. To build the PRIMME
library do the following:
1. Create a new project and include the source files under the
directory "src".
2. Add the directories "include" and "src/include" as include
directories.
To build an example code using PRIMME make sure:
* to add a reference for PRIMME, BLAS and LAPACK libraries;
* to add the directory "include" as an include directory.
Tested Systems
==============
PRIMME is primary developed with GNU gcc, g++ and gfortran (versions
4.8 and later). Many users have reported builds on several other
platforms/compilers:
* SUSE 13.1 & 13.2
* CentOS 6.6
* Ubuntu 18.04
* MacOS X 10.9 & 10.10
* Cygwin & MinGW
* Cray XC30
* FreeBSD 11.2
Main Contributors
=================
* James R. McCombs
* Eloy Romero Alcalde
* Andreas Stathopoulos
* Lingfei Wu
Eigenvalue Problems
*******************
* C Library Interface
* FORTRAN 77 Library Interface
* FORTRAN 90 Library Interface
* Python Interface
* MATLAB Interface
* Parameters Description
* Preset Methods
* Error Codes
C Library Interface
*******************
The PRIMME interface is composed of the following functions. To solve
real symmetric and complex Hermitian problems, standard A x = \lambda
x and generalized A x = \lambda B x, call:
int dprimme(double *evals, double *evecs, double *resNorms,
primme_params *primme);
int zprimme(double *evals, PRIMME_COMPLEX_DOUBLE *evecs, double *resNorms,
primme_params *primme);
There are more versions for matrix problems working in other
precisions:
+-------------+----------------------+----------------------+
| Precision | Real | Complex |
|=============|======================|======================|
| half | "hprimme()" | "kprimme()" |
| | "hsprimme()" | "ksprimme()" |
+-------------+----------------------+----------------------+
| single | "sprimme()" | "cprimme()" |
+-------------+----------------------+----------------------+
| double | "dprimme()" | "zprimme()" |
+-------------+----------------------+----------------------+
To solve standard eigenproblems with normal but not necessarily
Hermitian matrices call:
int zprimme_normal(PRIMME_COMPLEX_DOUBLE *evals, PRIMME_COMPLEX_DOUBLE *evecs,
double *resNorms, primme_params *primme);
There are more versions for matrix problems working in other
precisions:
+-------------+-----------------------------+
| Precision | Complex |
|=============|=============================|
| half | "kprimme_normal()" |
| | "kcprimme_normal()" |
+-------------+-----------------------------+
| single | "cprimme_normal()" |
+-------------+-----------------------------+
| double | "zprimme_normal()" |
+-------------+-----------------------------+
Other useful functions:
void primme_initialize(primme_params *primme);
int primme_set_method(primme_preset_method method,
primme_params *params);
void primme_display_params(primme_params primme);
void primme_free(primme_params primme);
PRIMME stores its data on the structure "primme_params". See
Parameters Guide for an introduction about its fields.
Running
=======
To use PRIMME, follow these basic steps.
1. Include:
#include "primme.h" /* header file is required to run primme */
2. Initialize a PRIMME parameters structure for default settings:
primme_params primme;
primme_initialize(&primme);
3. Set problem parameters (see also Parameters Guide), and,
optionally, set one of the "preset methods":
primme.matrixMatvec = LaplacianMatrixMatvec; /* MV product */
primme.n = 100; /* set problem dimension */
primme.numEvals = 10; /* Number of wanted eigenpairs */
ret = primme_set_method(method, &primme);
...
4. Then call the solver:
ret = dprimme(evals, evecs, resNorms, &primme);
The call arguments are:
* *evals*, array to return the found eigenvalues;
* *evecs*, array to return the found eigenvectors;
* *resNorms*, array to return the residual norms of the found
eigenpairs; and
* *ret*, returned error code.
5. To free the work arrays in PRIMME:
primme_free(&primme);
See usage examples at the directory *examples*.
Parameters Guide
================
PRIMME stores the data on the structure "primme_params", which has the
next fields:
/* Basic */
PRIMME_INT n; // matrix dimension
void (*matrixMatvec)(...); // matrix-vector product
void (*massMatrixMatvec)(...); // mass matrix-vector product
int numEvals; // how many eigenpairs to find
primme_target target; // which eigenvalues to find
int numTargetShifts; // for targeting interior eigenpairs
double *targetShifts;
double eps; // tolerance of the converged eigenpairs
/* For parallel programs */
int numProcs; // number of processes
int procID; // rank of this process
PRIMME_INT nLocal; // number of rows stored in this process
void (*globalSumReal)(...); // sum reduction among processes
void (*broadcastReal)(...); // broadcast array among processes
/* Accelerate the convergence */
void (*applyPreconditioner)(...); // precond-vector product
int initSize; // initial vectors as approximate solutions
int maxBasisSize;
int minRestartSize;
int maxBlockSize;
/* User data */
void *commInfo;
void *matrix;
void *massMatrix;
void *preconditioner;
void *convtest;
void *monitor;
/* Advanced options */
PRIMME_INT ldevecs; // leading dimension of the evecs
int numOrthoConst; // orthogonal constrains to the eigenvectors
int dynamicMethodSwitch;
int locking;
PRIMME_INT maxMatvecs;
PRIMME_INT maxOuterIterations;
PRIMME_INT iseed[4];
double aNorm;
double BNorm;
double invBNorm;
int printLevel;
FILE *outputFile;
double *ShiftsForPreconditioner;
primme_init initBasisMode;
struct projection_params projectionParams;
struct restarting_params restartingParams;
struct correction_params correctionParams;
struct primme_stats stats;
void (*convTestFun)(...); // custom convergence criterion
PRIMME_INT ldOPS; // leading dimension to use in matrixMatvec
void (*monitorFun)(...); // custom convergence history
primme_op_datatype matrixMatvec_type;
primme_op_datatype massMatrixMatvec_type;
primme_op_datatype applyPreconditioner_type;
primme_op_datatype globalSumReal_type;
primme_op_datatype broadcastReal_type;
primme_op_datatype internalPrecision;
primme_orth orth;
PRIMME requires the user to set at least the dimension of the matrix
("n") and the matrix-vector product ("matrixMatvec"), as they define
the problem to be solved. For parallel programs, "nLocal", "procID"
and "globalSumReal" are also required.
In addition, most users would want to specify how many eigenpairs to
find, "numEvals", and provide a preconditioner "applyPreconditioner"
(if available).
It is useful to have set all these before calling
"primme_set_method()". Also, if users have a preference on
"maxBasisSize", "maxBlockSize", etc, they should also provide them
into "primme_params" prior to the "primme_set_method()" call. This
helps "primme_set_method()" make the right choice on other parameters.
It is sometimes useful to check the actual parameters that PRIMME is
going to use (before calling it) or used (on return) by printing them
with "primme_display_params()".
Interface Description
=====================
The next enumerations and functions are declared in "primme.h".
?primme
-------
int hprimme(PRIMME_HALF *evals, PRIMME_HALF *evecs, PRIMME_HALF *resNorms, primme_params *primme)
int hsprimme(float *evals, PRIMME_HALF *evecs, float *resNorms, primme_params *primme)
int kprimme(PRIMME_HALF *evals, PRIMME_COMPLEX_HALF *evecs, PRIMME_HALF *resNorms, primme_params *primme)
int ksprimme(float *evals, PRIMME_COMPLEX_HALF *evecs, float *resNorms, primme_params *primme)
New in version 3.0.
int sprimme(float *evals, float *evecs, float *resNorms, primme_params *primme)
int cprimme(float *evals, PRIMME_COMPLEX_FLOAT *evecs, float *resNorms, primme_params *primme)
New in version 2.0.
int dprimme(double *evals, double *evecs, double *resNorms, primme_params *primme)
int zprimme(double *evals, PRIMME_COMPLEX_DOUBLE *evecs, double *resNorms, primme_params *primme)
Solve a real symmetric/Hermitian standard or generalized
eigenproblem.
All arrays should be hosted on CPU. The computations are performed
on CPU (see "magma_dprimme()" for using GPUs).
Parameters:
* **evals** – array at least of size "numEvals" to store the
computed eigenvalues; all processes in a parallel run return
this local array with the same values.
* **evecs** – array at least of size "nLocal" times
("numOrthoConst" + "numEvals") with leading dimension
"ldevecs" to store column-wise the (local part for this
process of the) computed eigenvectors.
* **resNorms** – array at least of size "numEvals" to store the
residual norms of the computed eigenpairs; all processes in
parallel run return this local array with the same values.
* **primme** – parameters structure.
Returns:
error indicator; see Error Codes.
On input, "evecs" should start with the content of the
"numOrthoConst" vectors, followed by the "initSize" vectors.
On return, the i-th eigenvector starts at evecs[( "numOrthoConst" +
i)* "ldevecs" ], with value *evals[i]* and associated residual
2-norm *resNorms[i]*. The first vector has index i=0. The number of
eigenpairs marked as converged (see "eps") is returned on
"initSize". Since version 4.0, if the returned error code is
*PRIMME_MAIN_ITER_FAILURE*, PRIMME may return also unconverged
eigenpairs and its residual norms in *evecs*, *evals*, and
*resNorms* starting at i=|initSize| and going up to either
"numEvals"-1 or the last *resNorms[i]* with non-negative value.
All internal operations are performed at the same precision than
"evecs" unless the user sets "internalPrecision" otherwise. The
functions "hsprimme()" and "ksprimme()" perform all computations in
half precision by default and report the eigenvalues and the
residual norms in single precision. These functions may help in
applications that may be not built with a compiler supporting half
precision.
The type and precision of the callbacks is also the same as
*evecs*. Although this can be changed. See details for
"matrixMatvec", "massMatrixMatvec", "applyPreconditioner",
"globalSumReal", "broadcastReal", and "convTestFun".
*magma_?primme*
---------------
int magma_hprimme(PRIMME_HALF *evals, PRIMME_HALF *evecs, PRIMME_HALF *resNorms, primme_params *primme)
int magma_hsprimme(float *evals, PRIMME_HALF *evecs, float *resNorms, primme_params *primme)
int magma_kprimme(PRIMME_HALF *evals, PRIMME_COMPLEX_HALF *evecs, PRIMME_HALF *resNorms, primme_params *primme)
int magma_sprimme(float *evals, float *evecs, float *resNorms, primme_params *primme)
int magma_ksprimme(float *evals, PRIMME_COMPLEX_HALF *evecs, float *resNorms, primme_params *primme)
int magma_cprimme(float *evals, PRIMME_COMPLEX_FLOAT *evecs, float *resNorms, primme_params *primme)
int magma_dprimme(double *evals, double *evecs, double *resNorms, primme_params *primme)
int magma_zprimme(double *evals, PRIMME_COMPLEX_DOUBLE *evecs, double *resNorms, primme_params *primme)
Solve a real symmetric/Hermitian standard or generalized
eigenproblem.
Most of the computations are performed on GPU (see "dprimme()" for
using only the CPU).
Parameters:
* **evals** – CPU array at least of size "numEvals" to store the
computed eigenvalues; all processes in a parallel run return
this local array with the same values.
* **evecs** – GPU array at least of size "nLocal" times
("numOrthoConst" + "numEvals") with leading dimension
"ldevecs" to store column-wise the (local part for this
process of the) computed eigenvectors.
* **resNorms** – CPU array at least of size "numEvals" to store
the residual norms of the computed eigenpairs; all processes
in parallel run return this local array with the same values.
* **primme** – parameters structure.
Returns:
error indicator; see Error Codes.
On input, "evecs" should start with the content of the
"numOrthoConst" vectors, followed by the "initSize" vectors.
On return, the i-th eigenvector starts at evecs[( "numOrthoConst" +
i)* "ldevecs" ], with value *evals[i]* and associated residual
2-norm *resNorms[i]*. The first vector has index i=0. The number of
eigenpairs marked as converged (see "eps") is returned on
"initSize". Since version 4.0, if the returned error code is
*PRIMME_MAIN_ITER_FAILURE*, PRIMME may return also unconverged
eigenpairs and its residual norms in *evecs*, *evals*, and
*resNorms* starting at i=|initSize| and going up to either
"numEvals"-1 or the last *resNorms[i]* with non-negative value.
All internal operations are performed at the same precision than
"evecs" unless the user sets "internalPrecision" otherwise. The
functions "hsprimme()" and "ksprimme()" perform all computations in
half precision by default and report the eigenvalues and the
residual norms in single precision. These functions may help in
applications that may be not built with a compiler supporting half
precision.
The type and precision of the callbacks is also the same as
*evecs*. Although this can be changed. See details for
"matrixMatvec", "massMatrixMatvec", "applyPreconditioner",
"globalSumReal", "broadcastReal", and "convTestFun".
New in version 3.0.