forked from stubbscroll/petsc-hello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.txt
32 lines (21 loc) · 1.04 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
"Hello world" in PETSc using cmake.
Programs:
- hello1: minimal hello world program
- solve1: rather minimal program that solves a system of equations
CMakeLists.txt: the cmake build file. It uses modules for locating the PETSc
library (placed in the directory cmake-modules), these modules are taken from
https://github.com/jedbrown/cmake-modules
A regular makefile is also included.
The usual PETSc requirements apply: prerequisite libraries (most notably MPI)
and the environment variables PETSC_DIR and PETSC_ARCH must be set.
How to build:
mkdir build
cd build
cmake -D CMAKE_C_COMPILER=${PETSC_DIR}/${PETSC_ARCH}/bin/mpicc ..
make
(In subsequent build runs in the same build tree, use `cmake ..`.)
Now there should be two executables (hello1, solve1) in the build directory.
Please note that PETSc (by default) uses MPI, so we need to change the
compiler. This is what the extra argument to cmake does. Neglecting to
change the compiler will lead to MPI-related linking errors.
In the future I might add more example files to this repository.