File: installation.html

package info (click to toggle)
petsc 3.14.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 266,472 kB
  • sloc: ansic: 680,898; python: 33,303; cpp: 16,324; makefile: 14,022; f90: 13,731; javascript: 10,713; fortran: 9,581; sh: 1,373; xml: 619; objc: 445; csh: 192; pascal: 148; java: 13
file content (1325 lines) | stat: -rw-r--r-- 57,370 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
  <head> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/installation.html" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>Documentation: Installation</title>
  </head>
  <body bgcolor="#ffffff">
   <div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
   <div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/installation.html "><small>Report Typos and Errors</small></a></div>

    <h1>Documentation: Installation</h1>

    

    <style type="text/css">
      .code, code, #details li > ul {
        color: red;
      }

      .code, #details li > ul:not([style]) {
        font-size: .9em;
        font-family: Pragmata, Menlo, 'DejaVu LGC Sans Mono', 'DejaVu Sans Mono', Consolas, 'Everson Mono', 'Lucida Console', 'Andale Mono', 'Nimbus Mono L', 'Liberation Mono', FreeMono, 'Osaka Monospaced', Courier, 'New Courier', monospace;
      }

      .code, #details li > ul {
        padding: .7em;
        padding-left: 2em;
      }

      .def, #details h3, #details h4 {
        color: #551a8b;
        font-weight: bold;
      }
    </style>

    <div id="main">

      <!-- This is here for the grepping between begin / end, weaksauce! -->

      <h3>Quick Instructions:</h3>
      <ul>
        <li>
          On systems where MPI and BLAS/LAPACK are installed.
          <ul class="code">
            <li>./configure</li>
            <li>make all check</li>
          </ul>
        </li>
        <li>
          Or to specify compilers and have PETSc download and install MPI and BLAS/LAPACK (when they are not already on your machine)
          <ul class="code">
            <li>./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack</li>
            <li>make all check</li>
          </ul>
        </li>
        <li>
          <a style="color: rgb(204,102,0);" href="#windows"><b>Microsoft Windows installation</b></a> and <a style="color: rgb(204,102,0);" href="#doemachines"><b>DOE large scale systems installation</b></a>
        </li>
      </ul>

Don't need Fortran, use --with-fortran-bindings=0 to reduce the build times. If you are not using external packages
that use Fortran (for example, MUMPS requires Fortran) you can use --with-fc=0 for even faster build times.

      <h3>Encounter problems?</h3>

      <ul>
        <li><b>Read the error message from ./configure!</b></li>
        <li>Read help <code>./configure --help</code></li>
        <li>Refer to <a href="#exampleusage">example usages</a> (e.g., build PETSc without a Fortran compiler)</li>
        <li><i><b>make</i></b> problems? Just copy/paste <i><b>make</i></b> command printed by configure including any PETSC_DIR and PETSC_ARCH options</li>
        <li> Check the <a href="https://www.mcs.anl.gov/petsc/documentation/bugreporting.html">bug-reporting</a> section</li>
      </ul>


      <h3>Notes:</h3>
      <ul>
        <li>Please obtain PETSc via the <a href="../download/index.html">repository</a> or download the <b>latest</b> patched tarball
        <li>To extract the sources use: <code>gunzip -c petsc-&#60;version number&#62;.tar.gz | tar -xof -</code></li>
        <li>We highly recommend installing PETSc as a <b>regular/non-root user</b>, perhaps in <b>/home/username/soft</b></li>
      </ul>

      <h3>Table of Contents:</h3>

      <ul>
        <li><a href="#exampleusage">Example usages</a></li>
        <li><a href="#compilers">Specify compilers and compiler options used to build PETSc [and perhaps external packages]</a></li>
        <li><a href="#external">External packages</a></li>
        <li><a href="#blaslapack">BLAS and LAPACK problems</a></li>
        <li><a href="#mpi">MPI problems / I don't want MPI</a></li>
        <li><a href="#root">Installation location: in-place or out-of-place.</li>
        <li><a href="#envvars">Environmental variables PETSC_DIR and PETSC_ARCH</li>
        <li><a href="#cross">Installing on machine requiring cross compiler or a job scheduler</a></li>
        <li><a href="#windows">Microsoft Windows installation</a></li>
        <li><a href="#usingtau">Installing with TAU instrumentation package</a></li>
        <li><a href="#CUDA">Installing PETSc to use NVIDIA GPUs (aka CUDA)</a></li>
        <li><a href="#Kokkos">Installing PETSc with Kokkos</a></li>
        <li><a href="#OpenCL">Installing PETSc to use GPUs and accelerators via OpenCL (NVIDIA, AMD, and Intel)</a></li>
        <li><a href="#pkgconfig">PETSc ./configure automatically generates Pkgconfig and module files for each install</a></li>
        <li><a href="#doemachines">Installing on large scale DOE systems</a></li>
        <li><a href="#iosandroid">Installing PETSc on an iOS or Android platform</a></li>
      </ul>


    </div>

    <hr>

    <div id="details">

      <div>
        <h3><a name="exampleusage">Example Usages:</a></h3>

        <ul>
          <li>
            Examples are at <b>config/examples/*.py</b>. We use some of these scripts
            locally for testing - for example one can update these files and run as:
            <ul>
              <li>./config/examples/arch-osx-10.6.py</li>
            </ul>
          </li>

          <li>
            Assuming BLAS, LAPACK, MPICH are not currently
            installed <code>./configure</code> will download &amp; install BLAS,
            LAPACK, MPICH if they are not already installed on the system):
            <ul>
              <li>./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack --download-mpich</li>
            </ul>
          </li>

          <li>
            Same as above - but do not have a fortran compiler [and want to use PETSc from C only].
            <ul>
              <li>./configure --with-cc=gcc --with-cxx=0 --with-fc=0 --download-f2cblaslapack --download-mpich</li>
            </ul>
          </li>

          <li>
            Same as above - but install in a user specified (prefix) location.
            <ul>
              <li>./configure --prefix=/home/user/soft/petsc-install --with-cc=gcc --with-cxx=0 --with-fc=0 --download-f2cblaslapack --download-mpich</li>
            </ul>
          </li>

          <li>
            If BLAS, LAPACK, MPI sources (in &quot;-devel&quot; packages in most distros) are already installed in default system/compiler locations and mpicc,
            mpif90, mpiexec are available via PATH - configure does not require any additional options.
            <ul>
              <li>./configure</li>
            </ul>
          </li>

          <li>
            If BLAS, LAPACK, MPI are already installed in known user location use:<br>
            [Note: Do not specify --with-cc --with-fc etc when using --with-mpi-dir -
            so that mpicc/mpif90 can be picked up from mpi-dir]
            <ul>
              <li>./configure --with-blaslapack-dir=/usr/local/blaslapack --with-mpi-dir=/usr/local/mpich</li>
            </ul>
            or
            <ul>
              <li>./configure --with-blaslapack-dir=/usr/local/blaslapack --with-cc=/usr/local/mpich/bin/mpicc --with-mpi-f90=/usr/local/mpich/bin/mpif90 --with-mpiexec=/usr/local/mpich/bin/mpiexec</li>
            </ul>
          </li>

          <li>
            Build Complex version of PETSc [using c++ compiler]:
            <ul>
              <li>./configure --with-cc=gcc --with-fc=gfortran --with-cxx=g++ --with-clanguage=cxx --download-fblaslapack --download-mpich --with-scalar-type=complex</li>
            </ul>
          </li>

          <li>
            Install 2 variants of PETSc, one with gnu, the other with Intel compilers. Specify different PETSC_ARCH for each build.
            <ul>
              <li>./configure PETSC_ARCH=linux-gnu --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich</li>
              <li>make PETSC_ARCH=linux-gnu all test</li>
              <li>./configure PETSC_ARCH=linux-gnu-intel --with-cc=icc --with-cxx=icpc --with-fc=ifort --download-mpich --with-blaslapack-dir=/usr/local/mkl</li>
              <li>make PETSC_ARCH=linux-gnu-intel all test</li>
            </ul>
          </li>

        </ul>
      </div><!-- #exampleusage -->

      <hr>



      <div>
        <h3><a name="compilers">Compilers:</a></h3>

        <p>Specify compilers and compiler options used to build PETSc [and perhaps external packages]</p>

        <ul>
          <li>
            Specify compilers using the options <code>--with-cc --with-cxx --with-fc</code> for c, c++, and fortran compilers
            <ul>
              <li>--with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90</li>
              <li>--with-cc=gcc --with-cxx=g++ --with-fc=gfortran</li>
              <li>--with-cc=gcc --with-cxx=g++ --with-fc=gfortran</li>
            </ul>
          </li>

          <li>
            If fortran compiler is not available or not needed - then disabling using fortran
            <ul>
              <li>--with-fc=0</li>
            </ul>
          </li>

          <li>
            If a C++ compiler is not available or not needed - disable configuring with it
            <ul>
              <li>--with-cxx=0</li>
            </ul>
          </li>

          <li>
            If no compilers are specified - configure will
            automatically look for available MPI or regular
            compilers in the user's PATH
            <ul>
              <li>mpicc/mpiCC/mpif90</li>
              <li>gcc/g++/gfortran</li>
              <li>cc/CC etc..</li>
            </ul>
          </li>

          <li>
            It's best to use MPI compilers
            as this will avoid the situation where MPI is compiled
            with one set of compilers [like gcc/gfortran] and user
            specified incompatible compilers to PETSc [perhaps
            icc/ifort]. This can be done by either specifying
            --with-cc=mpicc or --with-mpi-dir [and not
            --with-cc=gcc]
            <ul>
              <li>--with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90</li>
              <li>--with-mpi-dir=/opt/mpich2-1.1 [but <b>*no*</b> --with-cc=gcc]</li>
            </ul>
          </li>

          <li>
            Configure defaults to building PETSc in debug mode.
            One can switch to using optimzed mode with the configure
            option --with-debugging=0 (We suggest using a different PETSC_ARCH for debug and optimized builds, for example arch-debug and arch-opt, this
            way you can switch between debugging your code and running for performance by simply changing the value of PETSC_ARCH.
            Additionally one can specify more suitable optimization
            flags with the options COPTFLAGS, FOPTFLAGS,
            CXXOPTFLAGS. For example when using gnu compilers with corresponding
            optimization flags:
            <ul>
              <li>./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-debugging=0 COPTFLAGS='-O3 -march=native -mtune=native' CXXOPTFLAGS='-O3 -march=native -mtune=native' FOPTFLAGS='-O3 -march=native -mtune=native' --download-mpich</li>
            </ul>
          </li>

          <li>
            Configure cannot detect compiler libraries for certain
            set of compilers. In this case one can specify
            additional system/compiler libraries using the LIBS option
            <ul>
              <li>./configure --LIBS='-ldl /usr/lib/libm.a' </li>
            </ul>
          </li>

        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #compilers -->

      <hr>

      <div id="externalpackages">
        <h3><a name="external">External Packages:</a></h3>

        <p>
          PETSc provides interfaces to various <a href="../miscellaneous/external.html">external packages</a>.
          BLAS/LAPACK is a required package, MPI is not required if running sequentially. One can optionally use
          <a href="linearsolvertable.html">external solvers</a> like Hypre, MUMPS, etc. from within PETSc applications.
        </p>

        <p>
          PETSc configure has the ability to download and install these external packages. Alternatively if these packages
          are already installed, then configure can detect and use them.
        </p>

       <p>
         If you are behind a firewall and cannot use a proxy for the downloads or have a very slow network use the additional option <code>--with-packages-download-dir=/adirectory</code>.
         This will trigger ./configure to print the URLs of all the packages you must download this directory (do not uncompress or untar the files) and then
         use these copies of the packages instead of trying to download them directly from the internet.
       </p>
       

        <p>The following modes can be used to install/use external packages with configure.</p>

        <ul>
          <li>
            <span class="def">--download-PACKAGENAME</span>: Download specified
            package and install it and configure PETSc to use this package.
            <ul>
              <li>--download-fblaslapack --download-mpich</li>
              <li>--download-scalapack --download-mumps</li>
            </ul>
          </li>

          <li>
            <span class="def">--download-PACKAGENAME=/PATH/TO/package.tar.gz</span>:
            If ./configure cannot automatically download the package
            [due to network/firewall issues], one can download the
            package by alternative means [perhaps wget, curl, or scp via some
            other machine]. Once the tarfile is downloaded, the path
            to this file can be specified to configure with this
            option. Configure will proceed to install this package and
            then configure PETSc with it.

            <ul>
              <li>--download-mpich=/home/petsc/mpich2-1.0.4p1.tar.gz</li>
            </ul>
          </li>

          <li>
            <span class="def">--with-PACKAGENAME-dir=PATH</span>:
            If the external package is already installed - specify
            its location to configure [it will attempt to detect,
            include, library files from this location.] Normally this
            corresponds to the top-level installation dir for the
            package.

            <ul>
              <li>--with-mpi-dir=/home/petsc/software/mpich2-1.0.4p1</li>
            </ul>
            Note that we hightly recommend you have PETSc download and install the external packages rather than you installing them separately first. The reason is
            that this insures the packages are installed with the same compilers and compiler options etc as PETSc so that they can work together.
          </li>

          <li>
            <span class="def">--with-PACKAGENAME-include=INCLUDEPATH --with-PACKAGENAME-lib=LIBRARYLIST</span>:
            Usually a package is defined completely by its include file location -
            and library list. [If the package is already installed] - then one can use
            these two options to specify the package to configure. For example

            <ul>
              <li>
                --with-superlu-include=/home/petsc/software/superlu/include
                --with-superlu-lib=/home/petsc/software/superlu/lib/libsuperlu.a
              </li>

              <li>
                --with-parmetis-include=/sandbox/balay/parmetis/include
                --with-parmetis-lib="-L/sandbox/balay/parmetis/lib -lparmetis -lmetis"
              </li>

              <li>
                --with-parmetis-include=/sandbox/balay/parmetis/include
                --with-parmetis-lib=[/sandbox/balay/parmetis/lib/libparmetis.a,libmetis.a]
              </li>
            </ul>
          </li>

        </ul>

        <b>Notes:</b>

        <ul>
          <li>
            Run <code>./configure --help</code> to get the list of external
            packages and corresponding additional options [for example
            <code>--with-mpiexec</code> for MPICH]
          </li>

          <li>
            Generally one would use either one of the above 4 modes for any given
            package - and not mix these. [i.e mixing <code>--with-mpi-dir</code> and
            <code>--with-mpi-include</code> etc.. should be avoided]
          </li>

          <li>
            Some packages might not support certain options like
            <code>--download-PACKAGENAME</code> or
            <code>--with-PACKAGENAME-dir</code>. Architectures like Microsoft
            Windows might have issues with these options. In these cases,
            <code>--with-PACKAGENAME-include --with-PACKAGENAME-lib</code>
            options should be preferred.
          </li>

          <li>
            It's best to install some external packages like SuperLU_DIST, MUMPS,
            Hypre, METIS, and ParMETIS with the option <code>--download-PACKAGENAME</code>.  [the
            correct options for these packages are <code>--download-superlu_dist
              --download-mumps --download-hypre</code>]

            <ul style="color: black">
              <li>
                This will install the COMPATIBLE version of the external package.
                A generic install of this package might not be compatible with
                PETSc [perhaps due to version differences - or perhaps due to the
                requirement of additional patches for it to work with PETSc]
              </li>

              <li>
                Some packages have bug fixes, portability patches, and upgrades
                for dependent packages that have not yet been included in an
                upstream release.
              </li>

              <li>
                All packages will be installed with the same set of compilers
                - this avoids problems [for example weird link time errors] with
                mixing code compiled with multiple compilers [for example mixing
                gfortran and ifort compiled code].
              </li>
            </ul>
          </li>

          <li>
            If you want to download a compatible external package manually, then
            the URL for this package is listed in configure source for this
            package. For example, check
            <code>config/BuildSystem/config/packages/SuperLU.py</code> for the url for
            download this package.
          </li>
        </ul>

        <b>Additional options</b>:

        <ul>
          <li>
            <span class="def">--with-packages-build-dir=PATH</span>: By default,
            external packages will be unpacked and the build process is run in <code>${PETSC_DIR}/${PETSC_ARCH}/externalpackages</code>.
            However one can choose a different location where these packages are unpacked and the build process is run.
          </li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #externalpackages -->

      <hr>

      <div>
        <h3><a name="blaslapack">BLAS/LAPACK</a></h3>

        <p>These packages provide some basic numeric kernels used by PETSc.</p>

        <ul>
          <li>
            Configure will automatically look for blas/lapack in certain standard
            locations, on most systems you should not need to provide any
            information about BLAS/LAPACK in the ./configure command.
          </li>

          <li>
            One can use the following options to let configure download/install BLAS/LAPACK automatically.
            <ul>
              <li>--download-fblaslapack [when fortran compiler is present]</li>
              <li>--download-f2cblaslapack [when configuring without a fortran compiler - i.e --with-fc=0]</li>
            </ul>
          </li>

          <li>
            Alternatively one can use other options like one of the following.
            <ul>
              <li>--with-blaslapack-lib=libsunperf.a</li>
              <li>--with-blas-lib=libblas.a --with-lapack-lib=liblapack.a</li>
              <li>--with-blaslapack-dir=/soft/com/packages/intel/13/079/mkl</li>
            </ul>
          </li>
        </ul>

        <b>Notes:</b>

        <ul>
          <li> <h4> Intel MKL</h4>
            Intel provides BLAS/LAPACK via  the <a href="https://software.intel.com/en-us/mkl">MKL</a> library.
            It usually works from GNU/Intel compilers on Linux and Microsoft/Intel compilers on Microsoft Windows.
            One can specify it to PETSc configure with for example: <code>--with-blaslapack-dir=$MKLROOT</code> or, for example,
            <code>--with-blaslapack-dir=/soft/com/packages/intel/13/079/mkl</code>
            <br>
            If the above option does not work - one could determine the correct library list for your compilers using
            <a href="https://software.intel.com/sites/products/mkl/">Intel MKL Link Line Advisor</a>
               and specify with the configure option <code>--with-blaslapack-lib</code>
          </li>
          <li> <h4>IBM ESSL</h4>
            Sadly, IBM's ESSL does not have all the routines of BLAS and LAPACK
            that some packages, such as SuperLU expect; in particular slamch,
            dlamch and xerbla. In this case instead of using ESSL we suggest
            <code>--download-fblaslapack</code>. If you really want to use ESSL,
            see <a href="https://www.pdc.kth.se/hpc-services">https://www.pdc.kth.se/hpc-services</a>.
          </li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #blas -->

      <hr>

      <div id="mpi">
        <h3><a name="mpi">MPI</a></h3>

        <p>This software provides the parallel functionality for PETSc.</p>

        <ul>
          <li>Configure will automatically look for MPI compilers mpicc/mpif90 etc and use them if found in your PATH.</li>
          <li>
            One can use the following options to let configure download/install MPI automatically
            <ul>
              <li>--download-mpich [install and use MPICH]</li>
              <li>--download-openmpi [Install and use Open MPI]</li>
            </ul>
          </li>
          <li>See <a href="installation.html#external">externalpackages</a> for other installation options.</li>
        </ul>

        <h4><a name="mpicompilers">Using MPI Compilers:</a></h4>

        <ul>
          <li>
            It's best to install PETSc with MPI compiler wrappers (often called
            mpicc, mpicxx, mpif90) - this way, the SAME compilers used to build
            MPI are used to build PETSc [this avoids incompatibilities which
            might crop up - when using libraries compiled with different c or
            fortran compilers.]. This can be achieved with the following
            modes.
            <ul style="color: black">
              <li>
                Vendor provided MPI might already be installed. IBM, SGI, Cray etc provide their own:<br>
                <code>./config/confiure.py --with-cc=mpcc --with-fc=mpf90</code>
              </li>

               <li>
                If using MPICH which is already installed [perhaps using
                myrinet/gm] then use [without specifying --with-cc=gcc etc.so
                that configure picks up mpicc from mpi-dir]:<br>
                <code>./configure --with-mpi-dir=/path-to-mpich-install</code>
              </li>
            </ul>
          </li>
        </ul>

        <h4><a name="i-dont-want-to-use-mpi">Installing without MPI:</a></h4>

        <ul>
          <li>
            You can build (sequential) PETSc without an MPI. This is useful for
            quickly installing PETSc [if MPI is not available - for whatever
            reason]. However - if there is any MPI code in user application, then
            its best to install a full MPI - even if the usage is currently
            limited to uniprocessor mode.
            <ul>
              <li>./configure --with-mpi=0</li>
            </ul>
          </li>
        </ul>

        <h4>Installing with Open MPI with shared MPI libraries:</h4>

        <p>
          OpenMPI defaults to building shared libraries for MPI. However, the
          binaries generated by MPI wrappers mpicc/mpif90 etc require
          LD_LIBRARY_PATH to be set to the location of these libraries.
        </p>

        <p>
          Due to this OpenMPI restriction one has to set
          <code>LD_LIBRARY_PATH</code> correctly [per OpenMPI installation
          instructions], before running PETSc configure. If you do not set this
          environmental variables you will get messages when running
          <code>./configure</code> such as
        </p>

        <pre>
            UNABLE to EXECUTE BINARIES for config/configure.py
-------------------------------------------------------------------------------
            Cannot run executables created with C. If this machine uses a batch system
            to submit jobs you will need to configure using/configure.py with the additional option --with-batch.
            Otherwise there is problem with the compilers. Can you compile and run code with your C/C++ (and maybe Fortran) compilers?
        </pre>

        <p>or when running a code compiled with OpenMPI</p>

        <p>
          <code>
            -bash-3.3$ ./conftest <br>
            ./conftest: error while loading shared libraries: libmpi.so.0: cannot open shared object file: No such file or directory
          </code>
        </p>

        <h4>Notes:</h4>

        <ul>
          <li>
            Avoid specifing compilers [with options <code>--with-cc</code> or
            <code>--with-fc</code>] when using the option
            <code>--with-mpi-dir</code>. [Option<code>--with-mpi-dir</code>
            specifies using MPI compilers - so its best to use them - and not
            overwride them with user specified <code>--with-cc</code>].
          </li>

          <li>
            One can specify mpiexec or mpiexec with the options <code>--with-mpiexec</code>
          </li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #mpi -->

      <hr>


      <div>
        <h3><a name="root">Installation location: In-place or out-of-place</a></h3>

        By default, PETSc does an in-place installation, meaning the libraries are kept in the same directories used to compile PETSc. This is particularly useful for
        those application developers who follow the PETSc git repository <code>master</code> or <code>release</code> branches since rebuilds for updates are very quick and painless,
        see <a href="saws.html">easyrebuild</a>.

        <h4>Out-of-place installation with --prefix</h4>

        To install the libraries and include files in another location use the --prefix option


        <ul class="code">
          <li>./configure --prefix=/home/userid/petsc-3.14.0  [other configure options]</li>
        </ul>

        The libraries and include files needed by the users will be located in <code>/home/userid/petsc-3.14.0/lib</code> and <code>/home/userid/petsc-3.14.0/include</code>.</p>

        <strong>Installs in root location (uncommon).</strong>

        <p>
          If one wants to install PETSc in a common system
          location like /usr/local or /opt that requires root access we suggest creating a directory for
          PETSc  with user privileges, and then do the
          PETSc install [as a <b>regular/non-root user</b>]. i.e.
        </p>

        <ul class="code">
          <li>sudo mkdir /opt/petsc</li>
          <li>sudo chown user:group /opt/petsc</li>
          <li>cd /home/userid/petsc</li>
          <li>./configure --prefix=/opt/petsc/petsc-3.14.0  [other configure options]</li>
          <li>make</li>
          <li>make install</li>
        </ul>

        If one prefers to use root access for the install they only need change the final line

        <ul class="code">
          <li>sudo make install</li>
        </ul>

        One should never run configure or make on any package using root access.</p>

        <strong>Installs for package managers: using DESTDIR (very uncommon)</strong>

        <ul class="code">
          <li>./configure --prefix=/opt/petsc/petsc-3.14.0</li>
          <li>make</li>
          <li>make install DESTDIR=/tmp/petsc-pkg</li>
          <li>[package up /tmp/petsc-pkg The package should then be installed at /opt/petsc/petsc-3.14.0]</li>
        </ul>

        <strong>Multiple installs using --prefix [and DESTDIR]:</strong></p>

        Specify a different --prefix location for each configure of different options - at configure time. For example

        <ul class="code">
          <li>./configure --prefix=/opt/petsc/petsc-3.14.0-mpich --with-mpi-dir=/opt/mpich</li>
          <li>make</li>
          <li>make install [DESTDIR=/tmp/petsc-pkg]</li>
          <li>./configure --prefix=/opt/petsc/petsc-3.14.0-openmpi --with-mpi-dir=/opt/openmpi</li>
          <li>make</li>
          <li>make install [DESTDIR=/tmp/petsc-pkg]</li>
        </ul>

        <h4>In-place installation</h4>

        The PETSc libraries and generated included files are placed in the sub-directory off the current directory <code>$PETSC_ARCH</code>  which is either provided by the user with, for example,

        <ul class="code">
          <li>export PETSC_ARCH=arch-debug</li>
          <li>./configure </li>
          <li>make</li>
          <li>export PETSC_ARCH=arch-opt</li>
          <li>./configure --with-debugging=0</li>
          <li>make</li>
        </ul>

        or
        
        <ul class="code">
          <li> ./configure PETSC_ARCH=arch-debug</li>
          <li>make</li>
          <li> ./configure --with-debugging=0 PETSC_ARCH=arch-opt</li>
          <li>make</li>
        </ul>

        If not provided <code>./configure</code> will generate a unique value automatically (for in-place non <code>--prefix</code> configurations only)
        
        <ul class="code">
          <li> ./configure </li>
          <li>make</li>
          <li> ./configure --with-debugging=0 </li>
          <li>make</li>
        </ul>

        produces the directories (on an Apple MacOS machine) <code>arch-darwin-c-debug</code> and <code>arch-darwin-c-opt</code>.</p>

        The libraries and include files needed by the users are located off the current directory in  <code>$PETSC_ARCH/lib</code>, <code>include</code> and <code>$PETSC_ARCH/include</code></p>

        <strong>Following master or release on Git</strong></p>

        <a name="easyrebuild">If you follow the <code>master</code> or <code>release</code> branches off PETSc you can update your libraries with

        <ul class="code">
          <li> git pull</li>
          <li>make libs</li>
        </ul>

        Most of the time this will work, if there are errors regarding compiling Fortran stubs you need to also do  
        <ul class="code">
          <li>make allfortranstubs</li>
        </ul>

       If there are large changes in PETSc's configure code when you pull you may need to rerun the <code>./configure</code> which you can do with 

        <ul class="code">
          <li>$PETSC_ARCH/lib/petsc/conf/reconfigure-$PETSC_ARCH.py</li>
        </ul>


        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> 

<hr>

      <div>
        <h3><a name="envvars">Environmental variables PETSC_DIR and PETSC_ARCH</h3>

        Applications completely providing their own makefiles do not need to use <code>PETSC_DIR</code> or <code>PETSC_ARCH</code></p>

        <code>PETSC_DIR</code> and <code>PETSC_ARCH</code> (in-place installs only)
        are used by the PETSc <strong>makefiles</strong> to indicate which directory and configuration of PETSc to use when compiling examples or application code.
        These variables can be set as
        envirnment variables or specified on the command line 

        <ul>
          <li>
            specify enviornment variable for csh/tcsh [can be specified in ~/.cshrc]
            <ul>
              <li>setenv PETSC_DIR /home/balay/petsc-3.14.0</li>
              <li>setenv PETSC_ARCH linux-gnu-c-debug</li>
            </ul>
          </li>

          <li>
            specify environment variable for bash [can be specified in ~/.bashrc]
            <ul>
              <li>export PETSC_DIR=/home/balay/petsc-3.14.0</li>
              <li>export PETSC_ARCH=linux-gnu-c-debug</li>
            </ul>
          </li>

          <li>
            specify variable on commandline (bash) to build an example in src/ts/tutorials
            <ul>
              <li>PETSC_ARCH=linux-gnu-c-debug make PETSC_DIR=/home/balay/petsc-3.14.0 ex1</li>
            </ul>
          </li>
        </ul>


        <p>
          <code>PETSC_DIR</code>
          should point to the location of the PETSc
          installation. For out-of-place installations this is the <code>--prefix</code> location. For in-place installations it is the directory where you ran configure PETSc.
        </p>

        <p>
          <code>PETSC_ARCH</code>
          is only needed for in-place installations.
        </p>


        <a href="#" target="_top">Return to Installation Instructions</a>
      </div>

<hr>
      <div>
        <h3><a name="windows">Microsoft Windows Installation:</a></h3>

            Are you sure you want to use Microsoft Windows? We recommend using Linux
            if possible [and minimize troubleshooting Microsoft Windows related issues].
            
        <h4>Installation With GNU gcc/g++/gfortran compilers:</h4>
        
        The following configurations are much like regular Linux systems. Our regular [Linux] instructions
        should work with them. Most externalpackages will also work. The configure option --download-mpich should work
        for these systems. (These do not support Microsoft/Intel Windows compilers; nor can you use MS-MPI, Intel-MPI or MPICH2).
        
        <ul>
          <li>
            <a href="http://www.cygwin.com">Cygwin</a> Unix emulator for Microsoft Windows. See the instructions below for
            installing Cygwin for PETSc. Be sure to install the GNU compilers, do not use the win32fe script.
          </li>
          <li>
            <a href="https://devblogs.microsoft.com/commandline/announcing-wsl-2/">Microsoft Windows Subsystem for Linux 2 (WLS2)</a>.
            Untested, let us know your experience.
          </li>
          <li>
            <a href="https://docs.docker.com/docker-for-windows/">Docker for Microsoft Windows</a>.
            Untested, let us know your experience.
          </li>
          <li>
            <a href="https://www.atlassian.com/git/tutorials/git-bash">Git bash</a>. You must
            also install the GNU compilers via
            <a href="https://yichaoou.github.io/tutorials/software/2016/06/28/git-bash-install-gcc">MinGW</a>.
            Untested, let us know your experience.
          </li>
          <li>
            Linux virtual machine via <a href="https://www.virtualbox.org/">VirtualBox</a>.
            One sample tutorial is at
            <a href="https://www.psychocats.net/ubuntu/virtualbox">https://www.psychocats.net/ubuntu/virtualbox</a>.
            Google can provide more tutorials.
            Untested, let us know your experience.
          </li>
         </ul>

      <hr>


        <h4>Installation With Microsoft/Intel Windows Compilers:</h4>
        <p>
          Microsoft Windows does not provide the same unix shell enviornment
          as the other OSes. Also the default Microsoft/Intel compilers behave
          differently than other unix compilers. So to install PETSc on Microsoft
          Windows - one has to install <a href="http://www.cygwin.com">Cygwin</a>
          [for the unix enviornment] and use <a href="#win32fe">win32fe</a> [part
          of PETSc sources, to interface to Microsoft/Intel compilers].
        </p>

        <p>
          <strong>Install Cygwin: </strong>Please download and install
          Cygwin package from <a href="http://www.cygwin.com">http://www.cygwin.com</a>.
          Make sure the following Cygwin components are installed.
        </p>

        <ul>
          <li>python3</li>
          <li>make</li>
          <li>[default selection should already have <code>diff</code> and other tools]</li>
        </ul>
        <p>
        Note: If installing PETSc with <strong>Cygwin/GNU</strong> compilers - install  additional Cygwin components.
        <ul>
          <li>gcc-core gcc-g++ gcc-fortran</li>
          <li>liblapack-devel</li>
          <li>openmpi libopenmpi-devel</li>
        </ul>
        Additional cygwin components like <code>git cmake</code> can be useful for installing external packages.
        </p>
        <p>
          <strong>Remove Cygwin link.exe: </strong>Cygwin link.exe can
          conflict with Intel ifort compiler. If you are using ifort -
          please do [from Cygwin terminal/bash-shell]:
        </p>

        <ul>
          <li><code>mv /usr/bin/link.exe /usr/bin/link-cygwin.exe</code></li>
        </ul>

        <p>
          <strong>Setup Cygwin terminal/bash-shell with Working Compilers:
          </strong>We require the compilers to be setup properly in a Cygwin bash
          command shell, so that "<code>cl foo.c</code>" or "<code>ifort
            foo.f</code>" works from this shell. For example - if using VS2005
          C and Intel 10 Fortran one can do:
        </p>

        <ul>
          <li>
            Start -&gt; Programs -&gt; Intel Software Development Tools -&gt;
            Intel Fortran Compiler 10 -&gt; Visual Fortran Build Enviornment
            [32bit or 64bit depending on your usage]. This should start a 'dos
            cmd' shell.
          </li>

          <li>
            Within this shell - run Cygwin terminal/bash-shell mintty.exe as:
            <code>c:\cygwin\bin\mintty.exe</code>
          </li>

          <li>
            Within mintty.exe - run:<code>/usr/bin/bash --login</code>
          </li>
          
          <li>verify if the compilers are useable [by running cl, ifort in this Cygwin terminal/bash-shell]</li>

          <li>Now run configure with win32fe and then build the libraries with make [as per the usual instructions]</li>
        </ul>

        <strong>Example Configure usage with Microsoft Windows Compilers:</strong>

        <p>
          Use configure with VC2005 C and Intel Fortran 10 [Without MPI].
        </p>

        <ul>
          <li><code>./configure --with-cc='win32fe cl' --with-fc='win32fe ifort' --with-cxx='win32fe cl' --with-mpi=0 --download-fblaslapack</code></li>
        </ul>

        <p>If fortran, c++ usage is not required, use:</p>

        <ul>
          <li><code>./configure --with-cc='win32fe cl' --with-fc=0 --with-cxx=0 --download-f2cblaslapack</code></li>
        </ul>

        <p> <strong>Using MPI:</strong>
        We support both <a href="https://www.microsoft.com/en-us/download/details.aspx?id=57467">MS-MPI</a> [64-bit] and <a href="https://software.intel.com/en-us/mpi-library">Intel MPI</a> on Microsoft Windows (MPICH2 does not work, do not use it). For example usages, check <code>config/examples/arch-mswin*.py</code></p>

        <p> <strong>Avoiding spaces in PATHs:</strong>
        Its best to avoid spaces or similar special chars when specifying configure options. On Microsoft Windows - this usually affects specifying MPI or MKL. Microsoft Windows supports <b>dos short form</b> for dir names - so its best to use this notation. And cygwin tool <code>cygpath</code> can be used to get paths in this notation. For example
         <code><br><br>
           $ cygpath -u `cygpath -ms '/cygdrive/c/Program Files (x86)/Microsoft SDKs/MPI'`<br>
           /cygdrive/c/PROGRA~2/MICROS~2/MPI<br>
           $ cygpath -u `cygpath -ms '/cygdrive/c/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64'`<br>
           /cygdrive/c/PROGRA~2/INTELS~1/COMPIL~2/windows/mkl/lib/intel64<br><br>
         </code>
         i.e use:
         <ul>
	   <li><code>./configure --with-cc='win32fe cl' --with-fc='win32fe ifort' --with-cxx='win32fe cl' --with-shared-libraries=0 \<br>
               --with-mpi-include='[/cygdrive/c/PROGRA~2/MICROS~2/MPI/Include,/cygdrive/c/PROGRA~2/MICROS~2/MPI/Include/x64]' \<br>
               --with-mpi-lib='-L/cygdrive/c/PROGRA~2/MICROS~2/MPI/lib/x64 msmpifec.lib msmpi.lib' \<br>
               --with-mpiexec=/cygdrive/c/PROGRA~1/MICROS~2/Bin/mpiexec \<br>
               --with-blaslapack-lib='-L/cygdrive/c/PROGRA~2/INTELS~1/COMPIL~2/windows/mkl/lib/intel64 mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib'</code>
         </ul>
        <p>
          <strong>ExternalPackages</strong>: The <code>--download-package
          </code> option does not work with many external packages on Microsoft
          Windows.
        </p>

        <p>
          <strong>Project Files:</strong> We cannot provide Microsoft
          Visual Studio project files for users as they are specific to the
          configure options, location of external packages, compiler versions
          etc. used for any given build of PETSc, so they are potentially
          different for each build of PETSc. So if you need a project file for
          use with PETSc - please do the following.
        </p>

        <ul>
          <li>
            create an empty project file with one of the examples say
            <code>src/ksp/ksp/tutorials/ex2.c</code>
          </li>

          <li>
            try compiling the example from Cygwin bash shell - using makefile - for example
            <ul>
              <li>cd src/ksp/ksp/tutorials</li>
              <li>make ex2</li>
            </ul>
          </li>

          <li>
            if the above works - then make sure all the compiler/linker options
            used by make are also present in the project file in the correct
            notation.
          </li>

          <li>
            if errors - redo the above step. [if all the options are correctly
            specified - then the example should compile from MSDev.
          </li>
        </ul>

        <p>
          <strong>Debugger:</strong> Running PETSc probrams with
          -start_in_debugger is not supported on this platform, so debuggers will
          need to be initiated manually.  Make sure your environment is properly
          configured to use the appropriate debugger for your compiler. The
          debuggers can be initiated using Microsoft Visual Studio 6: <code>msdev
            ex1.exe</code>, Microsoft Visual Studio .NET: <code>devenv
            ex1.exe</code>, Intel Enhanced Debugger: <code>edb ex1.exe</code>, or
          GNU Debugger <code>gdb ex1.exe</code>.
        </p>

        <p>
          <strong><a name="win32fe">PETSc win32 front end</a>:</strong>
          This tool is used as a wrapper to Microsoft and Intel compilers
          and associated tools - to enable building PETSc libraries using Cygwin
          make and other UNIX tools. For additional info, run
          <code>${PETSC_DIR}/lib/petsc/bin/win32/win32fe</code> without any options.
        </p>

        <h4>Using MinGW with Microsoft/Intel Windows Compilers:</h4>
        Users report that it is possible to build to build PETSc using MinGW and link against them using the Microsoft/Intel Windows Compilers.
        We have no experience with this, nor knowledge on how it can be accomplished. Let us know your experience.

        <h4>Notes on using other systems besides Cygwin to compile with Microsoft and Intel compilers</h4>
        For any alternate system, we would have to redo win32fe functionality for that system. This includes

         <ul>
           <li>
             Marshal unix type compiler options to Cl (Microsoft compiler).
          </li>
          <li>
             Convert paths in some of these options from this system (for example Cygwin paths) to Microsoft Windows paths.
          </li>
          <li>
             Have python that works with system path notation.
          </li>
          <li>
             Have the ability equivalent to Microsoft Windows process spawning; Cygwin process spawning produces Microsoft Windows processes. WSL1 lacked this.
          </li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #windows -->

      <hr>

      <div>
        <h3><a name="pkgconfig">PETSc ./configure automatically generates Pkgconfig and module files for each install</a></h3>

       These can be found in ${PETSC_DIR}/${PETSC_ARCH}/lib/pkgconfig/petsc.pc and ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/modules/${PETSC_VERSION}-${PETSC_ARCH}.
        The module file may need to be edited for your particular system. Note that if --prefix is used then $PETSC_ARCH is not included in the above directories
        nor is -${PETSC_ARCH} included in the module file name.

        </p>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #pkgconfig -->

      <hr>

      <div id="cross">
        <h3><a name="SP">Installing packages that utilize OpenMP:</a></h3>

        <p>
          Some external packages include MKL BLAS/LAPACK, OpenBLAS, SuperLU_DIST, and Hypre support using OpenMP for
          thread level parallelism in addition to the MPI parallelism in PETSc. To utilize this insure your compilers
          support OpenMP and use the additional configure option  <code>--with-openmp</code>
        </p>

        <p>
          To control the number of OpenMP threads each MPI process utilizes you can set the environmental variable <code>OMP_NUM_THREADS n</code> or
            the PETSc command line option <code>-omp_num_threads n</code>.
        </p>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #cross -->

      <hr>

      <div id="module">
        <h3><a name="module">Installing on machines that use the module command:</a></h3>

        <p>
          On systems where you can use modules to load packages such as HDF5, the locations of the include files and libraries are known
          by the compiler. Hence you simply load the appropriate module for the package and run <code>./configure</code> with the option <code>--with-package</code>.
          For example
           <ul>
          <li>
            module load hdf5
          </li>
          <li>
            ./configure --with-hdf5 
          </li>
        </p>


        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #module -->

      <hr>

      <div id="cross">
        <h3><a name="cross">Installing on machine requiring cross compiler or a job scheduler (Batch systems):</a></h3>

        <p>
          On systems where you need to use a job scheduler or batch submission to run jobs
          use the configure option  <code>--with-batch</code>. On such systems the <code>make check</code> option will not work
        </p>

        <ul>
          <li>
            You must first insure you have loaded appropriate modules for the compilers etc that you
            wish to use. Often the compilers are provided automatically for you and you do not need to provide <code>--with-cc=XXX</code> etc
            Consult with the documentation and local support for such systems for information on these topics.
          </li>
          <li>
            On such systems you generally should not provide <code>--with-blaslapack-dir</code> or <code>--download-fblaslapack</code> since the
            systems provide those automatically (sometimes appropriate modules must be loaded first)
          </li>
          <li>
            Some packages <code>--download-package</code> options do not work on these systems, for example HDF5. Thus you must use
            modules to load those packages and <code>--with-package</code> to configure with the package.
          </li>
          <li>
            Since building external packages on these systems is often troublesome and slow we recommend only installing PETSc with those
            configuration packages that you need for your work, not extras.
          </li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #cross -->

      <hr>

      <div id="tau">
        <h3><a name="usingtau">Installing with TAU Instrumentation package:</a></h3>

        <p>
          <a href="http://www.cs.uoregon.edu/research/paracomp/tau/tautools/">TAU</a>
          package and the prerequisite <a href="http://www.cs.uoregon.edu/research/paracomp/pdtoolkit/">PDT</a>
          packages need to be installed separately [perhaps with MPI].
          Now use tau_cc.sh as compiler to PETSc configure.
        </p>

        <ul class="code">
          <li>export TAU_MAKEFILE=/home/balay/soft/linux64/tau-2.20.3/x86_64/lib/Makefile.tau-mpi-pdt</li>
          <li>./configure CC=/home/balay/soft/linux64/tau-2.20.3/x86_64/bin/tau_cc.sh --with-fc=0 PETSC_ARCH=arch-tau</li>
        </ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #tau -->

      <hr>

      <div>
        <h3><a name="CUDA">Installing PETSc to use NVIDIA GPUs (aka CUDA)</a></h3>

        <ul>
          <li>
            Requires <a href="https://developer.nvidia.com/cuda-downloads"> CUDA</a>,
          </li>

          <li>
            On Linux - make sure you have compatible <a href="https://developer.nvidia.com/cuda-downloads"> NVIDIA driver</a>
            installed.
          </li>

          <li>In most cases you need only pass the configure option --with-cuda; check <code>config/examples/arch-ci-linux-cuda-double.py</code> for example usage.</li>
        </ul>

        <p>
          CUDA build of PETSc currently works on Mac OS X, Linux, Microsoft Windows.
        </p>

        <p>
        Examples that use CUDA have the suffix .cu; see see src/snes/tutorials/ex47.cu
        </p>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #CUDA -->

      <hr>
      <h3><a name="Kokkos">Installing PETSc with Kokkos</a></h3>

       <p>
       In most cases you need only pass the configure option --download-kokkos and one of --with-cuda --with-openmp --with-pthread (or nothing to use sequential Kokkos)
       </p>

       <p>
          Examples that use Kokkos have the suffix .kokkos.cxx; see src/snes/tutorials/ex3k.kokkos.cxx
      </p>

        <a href="#" target="_top">Return to Installation Instructions</a>
    </div>

    <hr>

      <div>
        <h3><a name="OpenCL">Installing PETSc to use GPUs and accelerators via OpenCL (NVIDIA, AMD, Intel MIC)</a></h3>

        <ul>
          <li>
            Requires the OpenCL shared library, which is shipped in the vendor graphics driver and the OpenCL headers; if needed you can download them
            from the <a href="https://www.khronos.org/opencl/">Khronos Group</a> directly.
            Package managers on Linux provide these headers through a package named 'opencl-headers' or similar.
            On Apple systems the OpenCL drivers and headers are always available and do not need to be downloaded.
          </li>

          <li>
            Always make sure you have the latest GPU driver installed. There are several known issues with older driver versions.
          </li>

          <li>Run configure with --download-viennacl; check <code>config/examples/arch-ci-linux-viennacl.py</code> for example usage.</li>
        </ul>

        <p>
          OpenCL/ViennaCL builds of PETSc currently work on Mac OS X, Linux, and Microsoft Windows.
        </p>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #OpenCL -->

      <hr>

      <div>
        <h3><a name="doemachines">Installing on Large Scale DOE Systems</a></h3>

        <ul>
          <li>
            NERSC - CORI machine.
            <ul>
              <li>
                Project ID: m3353
              </li>
              <li>
                PI: Richard Mills
            </li>
              <li>
                Notes on usage:
            </li>
            </ul>
          </li>
          <li>
            ALCF - Argonne National Laboratory - theta machine - Intel KNL based system
            <ul>
              <li>
                Project ID: 
              </li>
              <li>
                PI:
            </li>
              <li>
                Notes on usage:
                 <ul>
                  <li> Log into theta.alcf.anl.gov </li>
                  <li> There are three compiler suites <a href="https://www.alcf.anl.gov/user-guides/compiling-and-linking-xc40">Modules</a>
                 <ul>
                  <li> module load PrgEnv-intel intel </li>
                  <li>  module load PrgEnv-gnu gcc/7.1.0/</li>
                  <li>  module load PrgEnv-cray </li>
                </ul>
                  <li> List currently loaded modules: module list                  </li>
                  <li> List all available modules: module avail                  </li>
                  <li> Blas/lapack will automatically be found so you do not need to provide it </li>
                 <ul>
                  <li> It is best not to use built-in modules for external packages (except blas/lapack) because they are often buggy.
                       Most external packages can be built using the --download option with the intel or Gnu environment but not cray </li>
                  <li> You can use config/examples/arch-cray-xc40-knl-opt.py as a template for running configure but it is outdated </li>
                  <li> When using the Intel module you may need to use --download-sowing-cc=icc --download-sowing-cxx=icpc -download-sowing-cpp="icc -E" --download-sowing-cxxpp="icpc -E" since the GNU compilers may not work as they access Intel files</li>
                  </li>
                  <li> To get an interactive node use qsub -A CSC250STMS07 -n 1 -t 60 -q debug-flat-quad -I </li>
                  <li> To run on interactive node using two MPI ranks use aprun -n 2 ./program options</li>
            </ul>
          </li>
              </ul>
              </ul> </ul>
          <li>
            OLCF - Oak Ridge National Laboratory - Summit machine - NVIDIA GPUs and IBM Power PC processors
            <ul>
              <li>
                Project ID: CSC314
              </li>
              <li>
                PI: Barry Smith
            </li>
              <li>
                Apply at: https://docs.olcf.ornl.gov/accounts/accounts_and_projects.html#applying-for-a-user-account
                </li>
              <li>
                Notes on usage:
                <ul>
                  <li>  <a href="https://www.olcf.ornl.gov/support/getting-started/olcf-user-account-application/">Getting Started</a> </li>
                  <li> Log into summit.olcf.ornl.gov </li>
                  <li>  module load cmake hdf5 cuda</li>
                   <ul>
                     <li>  module load pgi (for PGI compilers)   </li>
                     <li>  module load essl netlib-lapack xl (for IBM compilers)   </li>
                     <li>  module load gcc (for GNU compilers)   </li>
                     </ul>
                  <li> Use config/examples/arch-olcf-opt.py as a template for running configure </li>
                  <li> You configure PETSc and build examples in your home directory, but launch them from your "work" directory. </li>
                  <li> Use the bsub command to submit jobs to the queue. See the "Batch Scripts" section here
                       <a href="https://www.olcf.ornl.gov/for-users/system-user-guides/summit/summit-user-guide/#running-jobs.">running jobs</a> </li>
                  <li>  Tools for profiling   </li>
                  <ul>
                     <li>  -log_view that adds GPU communication and computation to the summary table   </li>
                     <li>  nvprof and nvvp from the CUDA toolkit </li>
                     </ul>
            </ul>
        

</ul>
</ul>

        <a href="#" target="_top">Return to Installation Instructions</a>
      </div>

    <hr>

      <div>
        <h3><a name="iosandroid">Installing PETSc on an iOS or Android platform</a></h3>

        <ul>
          <li>
            For iOS see systems/Apple/iOS/bin/makeall
          </li>
          <li>
            A thorough discussion of the installation procedure is given <a href="https://www.researchgate.net/publication/308973080_Comparison_of_Migration_Techniques_for_High-Performance_Code_to_Android_and_iOS">here</a>.
          </li>

          <li>
            For Android, you must have your standalone bin folder in the path, so that the compilers are visible.
          </li>

          <li>Check <code>config/examples/arch-arm64-opt.py</code> for iOS
            and <code>config/examples/arch-armv7-opt.py</code> for example usage.</li>
        </ul>


        <a href="#" target="_top">Return to Installation Instructions</a>
      </div> <!-- #iosandroid -->

      <hr>

    </div> 
  </body>
</html>