Skip to content

OptimalDesignLab/PETSc2.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PETSc

This package provides thin wrappers for PETSc, as well as a few convenience functions that take advantage of multiple dispatch.

This package requires the MPI.jl package be installed. Once it is installed you should be able to run both Julia and Petsc in parallel using MPI for all communication. The testing verifies that PETSc can be used both serially and in parallel.

To run PETSC in parallel, do:

mpirun -np 4 julia ./name_of_file

for a 4 processor run. Note that this launches 4 independent Julia processes. They are not aware of each other using Julia's built-in parallelism, and MPI is used for all communications.

To run in serial, do:

julia ./name_of_file

Even when running serially, the MPI.jl package must be installed.

Notes on wrapping functions

Wrappers generated by Clang.jl are in the src/auto directory. Although not quite usable, the functions can be made useable with a few simple modifications:

  • Pass comm.val instead of comm itself for MPI communicators, and change the type to comm_type, which is typealiased to the the type used by the MPI.jl package
  • Pass obj.pobj instead of obj for Petsc objects as Ptr{Void}
  • For each Petsc object, you must create a type that holds a void pointer called pobj and use that in place of the (incorrect) type generated by Clang.jl
  • For every function you add, create a test

Directory Structure

/src : source files. PETSc.jl is the main file containing initialization, with the functions for each type of Petsc object in its own file. All constants are declared in petsc_constants.jl.

/src/auto: auto generated wrappers from Clang.jl. Not directly useful, but easy to modify to make useful

/test : contains runtest.jl, which does some setup and runs all tests on the current PETSc installation. Tests for each type of Petsc object (mirroring the files in /src) are contained in separate files. The file runtests.sh builds PETSc and runs the tests on combinations of integer size, floating point precision, and type of scalar (real or complex).

/deps : builds Petsc if needed. See description below /docs: documentation (using Documenter.jl)

Versions

  • v0.1: tag before upgrading from Julia 0.4 to Julia 0.6
  • v0.2: tag after upgrading from Julia 0.4 to Julia 0.6
  • v0.3: update docs
  • v0.4: update build system to use environment variables too
  • v0.5: update to Petsc 3.9.4 (for Travis CI)

Build Status