Skip to content

Commit

Permalink
Merge pull request #1 from dougshidong/master
Browse files Browse the repository at this point in the history
Hanging node fix
  • Loading branch information
KeiganMacLean committed Oct 24, 2019
2 parents 13fb4c2 + 06e471b commit 3ecd57f
Show file tree
Hide file tree
Showing 75 changed files with 4,300 additions and 828 deletions.
3 changes: 1 addition & 2 deletions .codedocs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CodeDocs.xyz Configuration File

EXCLUDE_PATTERNS = */deprecated/*
DOXYFILE = doc/doxygen.cfg.in
DOXYFILE = doc/doxygen_codedocs.cfg

35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
os: linux
dist: bionic
language: c++

install:
- chmod u+x ci/travis-ci.sh

stages:
- doc
#- build and test
#- deploy

jobs:
include:
# - stage: build and test
# env: TITLE="Build CCORE (Linux)."
# script: ./ci/travis-ci.sh BUILD_CCORE
# - state: build and test
# env: TITLE="Run C/C++ static code analyser."
# script: ./ci/travis-ci.sh ANALYSE_CCORE
# - stage: build and test
# env: TITLE="Run unit-tests for CCORE."
# script: ./ci/travis-ci.sh UT_CCORE
# - stage: build and test
# env: TITLE="Run memory leak analyser (valgrind) for CCORE."
# script: ./ci/travis-ci.sh VALGRIND_CCORE
# - stage: build and test
# env: TITLE="PyClustering unit and integration testing."
# script: ./ci/travis-ci.sh TEST_PYCLUSTERING
# - stage: build and test
# os: osx
# env: TITLE="Build CCORE (MacOS) and intergration testing."
# script: ./ci/travis-ci.sh BUILD_TEST_CCORE_MACOS
- stage: doc
env: TITLE="Build documentation."
script: ./ci/travis-ci.sh DOCUMENTATION
81 changes: 42 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,48 @@ set(MPIMAX 4 CACHE STRING "Default number of processors used in ctest mpirun -np
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(CLEAN_UP_FILES ./bin/* ./CMakeCache.txt)

# Find deal.ii library
find_package(deal.II 9.0.1 QUIET
HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
message(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()
DEAL_II_INITIALIZE_CACHED_VARIABLES()

# Make sure deal.II has the proper external dependencies
IF(NOT ${DEAL_II_WITH_MPI})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_MPI=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_TRILINOS})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_TRILINOS=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_P4EST})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_P4EST=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_METIS})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_METIS=ON ***\n\n")
ENDIF()

# Use ld.gold for faster linking
option(USE_LD_GOLD "Use GNU gold linker" OFF)
if(USE_LD_GOLD AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version OUTPUT_VARIABLE stdout ERROR_QUIET)
if("${stdout}" MATCHES "GNU gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
else()
message(WARNING "GNU gold linker isn't available, using the default system linker.")
endif()
endif()

option(DOC_ONLY "Only generate code for documentation sake. Not compilable." OFF)
if(NOT DOC_ONLY)
# Find deal.ii library
find_package(deal.II 9.0.1 QUIET
HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
message(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()
DEAL_II_INITIALIZE_CACHED_VARIABLES()

# Make sure deal.II has the proper external dependencies
IF(NOT ${DEAL_II_WITH_MPI})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_MPI=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_TRILINOS})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_TRILINOS=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_P4EST})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_P4EST=ON ***\n\n")
ENDIF()
IF(NOT ${DEAL_II_WITH_METIS})
message(FATAL_ERROR "\n" "*** deal.II needs to be configured with -DDEAL_II_WITH_METIS=ON ***\n\n")
ENDIF()

# Use ld.gold for faster linking
option(USE_LD_GOLD "Use GNU gold linker" OFF)
if(USE_LD_GOLD AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version OUTPUT_VARIABLE stdout ERROR_QUIET)
if("${stdout}" MATCHES "GNU gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
else()
message(WARNING "GNU gold linker isn't available, using the default system linker.")
endif()
endif()
endif() # DOC_ONLY

add_custom_target(1D COMMAND ${CMAKE_COMMAND} -E echo "Makes all 1D executables, including tests. Allows ctest -R 1D")
add_custom_target(2D COMMAND ${CMAKE_COMMAND} -E echo "Makes all 2D executables, including tests. Allows ctest -R 2D")
add_custom_target(3D COMMAND ${CMAKE_COMMAND} -E echo "Makes all 3D executables, including tests. Allows ctest -R 3D")
Expand Down
120 changes: 61 additions & 59 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
## deal.II

This is the main library being used by this code. Since we are using advanced features, we only support the `master` of deal.II, which means it will have to be installed from source by cloning their [repository](https://github.com/dealii/dealii).

Most of the packages are readily available through `apt install`. p4est might need to be installed from source since the current p4est version available on `apt` is lower than what is required by deal.II (p4est 2.0). A small set of instructions is available [here](https://www.dealii.org/current/external-libs/p4est.html).

There is an [example script](doc/install_dealii.sh) for what has been used to install deal.II. You may need to provide the path such as `-DTRILINOS_DIR` if CMake does not find the package on its own.

The deal.II library has been setup with the following options:

~~~~
deal.II configuration:
CMAKE_BUILD_TYPE: DebugRelease
BUILD_SHARED_LIBS: ON
CMAKE_INSTALL_PREFIX: /home/ddong/Codes/dealii/install
CMAKE_SOURCE_DIR: /home/ddong/Codes/dealii
(version 9.0.1, shortrev 097bf59e49)
CMAKE_BINARY_DIR: /home/ddong/Codes/dealii/build
CMAKE_CXX_COMPILER: GNU 7.3.0 on platform Linux x86_64
/usr/bin/mpicxx
Configured Features (DEAL_II_ALLOW_BUNDLED = ON, DEAL_II_ALLOW_AUTODETECTION = ON):
( DEAL_II_WITH_64BIT_INDICES = OFF )
DEAL_II_WITH_ADOLC set up with external dependencies
DEAL_II_WITH_ARPACK set up with external dependencies
( DEAL_II_WITH_ASSIMP = OFF )
DEAL_II_WITH_BOOST set up with external dependencies
( DEAL_II_WITH_CUDA = OFF )
DEAL_II_WITH_CXX14 = ON
DEAL_II_WITH_CXX17 = ON
DEAL_II_WITH_GMSH set up with external dependencies
DEAL_II_WITH_GSL set up with external dependencies
( DEAL_II_WITH_HDF5 = OFF )
DEAL_II_WITH_LAPACK set up with external dependencies
DEAL_II_WITH_METIS set up with external dependencies
DEAL_II_WITH_MPI set up with external dependencies
DEAL_II_WITH_MUPARSER set up with bundled packages
( DEAL_II_WITH_NANOFLANN = OFF )
( DEAL_II_WITH_NETCDF = OFF )
DEAL_II_WITH_OPENCASCADE set up with external dependencies
DEAL_II_WITH_P4EST set up with external dependencies
DEAL_II_WITH_PETSC set up with external dependencies
DEAL_II_WITH_SCALAPACK set up with external dependencies
DEAL_II_WITH_SLEPC set up with external dependencies
DEAL_II_WITH_SUNDIALS set up with external dependencies
( DEAL_II_WITH_THREADS = OFF )
DEAL_II_WITH_TRILINOS set up with external dependencies
DEAL_II_WITH_UMFPACK set up with external dependencies
DEAL_II_WITH_ZLIB set up with external dependencies
Component configuration:
( DEAL_II_COMPONENT_DOCUMENTATION = OFF )
DEAL_II_COMPONENT_EXAMPLES
( DEAL_II_COMPONENT_PACKAGE = OFF )
( DEAL_II_COMPONENT_PYTHON_BINDINGS = OFF )
Detailed information (compiler flags, feature configuration) can be found in detailed.log
Run $ make info to print a help message with a list of top level targets
~~~~

## Installation of PHiLiP on Beluga cluster

This section is aimed McGill's group who use Compute Canada's Beluga cluster.
Expand Down Expand Up @@ -72,65 +133,6 @@ since it takes a very long time.

If you have any questions, feel free to contact me.

## deal.II

This is the main library being used by this code. Most of the packages are readily available through apt. p4est might need to be installed from source since the apt version is lower than what is required by deal.II.

There is an [example script](install_dealii.sh) for what has been used to install deal.II. You may need to provide the path such as `-DTRILINOS_DIR` if CMake does not find the package on its own.

The deal.II library has been setup with the following options:

~~~~
deal.II configuration:
CMAKE_BUILD_TYPE: DebugRelease
BUILD_SHARED_LIBS: ON
CMAKE_INSTALL_PREFIX: /home/ddong/Codes/dealii/install
CMAKE_SOURCE_DIR: /home/ddong/Codes/dealii
(version 9.0.1, shortrev 097bf59e49)
CMAKE_BINARY_DIR: /home/ddong/Codes/dealii/build
CMAKE_CXX_COMPILER: GNU 7.3.0 on platform Linux x86_64
/usr/bin/mpicxx
Configured Features (DEAL_II_ALLOW_BUNDLED = ON, DEAL_II_ALLOW_AUTODETECTION = ON):
( DEAL_II_WITH_64BIT_INDICES = OFF )
DEAL_II_WITH_ADOLC set up with external dependencies
DEAL_II_WITH_ARPACK set up with external dependencies
( DEAL_II_WITH_ASSIMP = OFF )
DEAL_II_WITH_BOOST set up with external dependencies
( DEAL_II_WITH_CUDA = OFF )
DEAL_II_WITH_CXX14 = ON
DEAL_II_WITH_CXX17 = ON
DEAL_II_WITH_GMSH set up with external dependencies
DEAL_II_WITH_GSL set up with external dependencies
( DEAL_II_WITH_HDF5 = OFF )
DEAL_II_WITH_LAPACK set up with external dependencies
DEAL_II_WITH_METIS set up with external dependencies
DEAL_II_WITH_MPI set up with external dependencies
DEAL_II_WITH_MUPARSER set up with bundled packages
( DEAL_II_WITH_NANOFLANN = OFF )
( DEAL_II_WITH_NETCDF = OFF )
DEAL_II_WITH_OPENCASCADE set up with external dependencies
DEAL_II_WITH_P4EST set up with external dependencies
DEAL_II_WITH_PETSC set up with external dependencies
DEAL_II_WITH_SCALAPACK set up with external dependencies
DEAL_II_WITH_SLEPC set up with external dependencies
DEAL_II_WITH_SUNDIALS set up with external dependencies
( DEAL_II_WITH_THREADS = OFF )
DEAL_II_WITH_TRILINOS set up with external dependencies
DEAL_II_WITH_UMFPACK set up with external dependencies
DEAL_II_WITH_ZLIB set up with external dependencies
Component configuration:
( DEAL_II_COMPONENT_DOCUMENTATION = OFF )
DEAL_II_COMPONENT_EXAMPLES
( DEAL_II_COMPONENT_PACKAGE = OFF )
( DEAL_II_COMPONENT_PYTHON_BINDINGS = OFF )
Detailed information (compiler flags, feature configuration) can be found in detailed.log
Run $ make info to print a help message with a list of top level targets
~~~~

To compile deal.II on the Beluga cluster, load the following modules.

~~~~
Expand Down
66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ The math supporting this code can be viewed in this **very rough draft in progre
- Supported elements: LINEs, QUADs, HEXs since it uses deal.II
- Supported refinements: h (size) or p (order).

## Documentation

The code itself is documented using Doxygen, and the latest documentation is hosted on [codedocs.xyz](https://codedocs.xyz/dougshidong/PHiLiP/).

Since deal.II is heavily used, their [documentation](https://www.dealii.org/developer/doxygen/deal.II/index.html) is probably the most useful.

Another great ressource is the [deal.II Google Groups](https://groups.google.com/forum/#!forum/dealii), where developers are actively answering questions.

Finally, I am also always available to answer questions regarding the code by e-mail at doug.shi-dong@mail.mcgill.ca

## Building/Running the Code

The code has been succesfully built in the following environments:
Expand Down Expand Up @@ -55,10 +65,12 @@ The html documentation can be accessed by pointing a browser at `ROOT/doc/html/i

## Testing

A list of currently known failing tests is kept in the [GitHub issues](https://github.com/dougshidong/PHiLiP/issues?q=is%3Aissue+is%3Aopen+label%3Atestfail) with `testfail` tags.

Testing can be performed using CMake's `ctest` functionality. After successfully compiling the project, all tests can be
run by executing:
```sh
$ ROOT$ make test (which is equivalent to ROOT$ make test)
$ ROOT$ ctest (which is equivalent to ROOT$ make test)
```

An alternative make target is provided to run tests with --output-on-failure:
Expand Down Expand Up @@ -87,7 +99,10 @@ For a serial run, you may simply use gdb as intended
ROOT$ gdb --args commmand_to_launch_test
GDB$ run (Executes the program. Can re-launch the program if you forgot to put breakpoints.)
```
For example `--args /home/ddong/Codes/PHiLiP_temp/PHiLiP/build_debug/bin/PHiLiP_2D "-i" "/home/ddong/Codes/PHiLiP_temp/PHiLiP/build_de bug/tests/adv ection_implicit/2d_advection_implicit_strong.prm`.
For example
```
gdb --args /home/ddong/Codes/PHiLiP_temp/PHiLiP/build_debug/bin/PHiLiP_2D "-i" "/home/ddong/Codes/PHiLiP_temp/PHiLiP/build_debug/tests/advection_implicit/2d_advection_implicit_strong.prm
```
Additional useful commands are:
Expand All @@ -99,6 +114,14 @@ GDB$ next (Execute the next line of code in the function. Will NOT go into the f
GDB$ quit
```
### Memory
Memory leaks can be detected using Valgrind's tool `memcheck`. The application must be compiled in `Debug` mode. For example
```
valgrind --leak-check=full --track-origins=yes /home/ddong/Codes/PHiLiP/build_debug/bin/2D_HighOrder_MappingFEField
```
### Parallel debugging
If the error only occurs when using parallelism, you can use the following example command
Expand All @@ -107,6 +130,45 @@ mpirun -np 2 xterm -hold -e gdb -ex 'break MPI_Abort' -ex run --args /home/ddong
```
This launches 2 xterm processes, each of which will launch gdb processes that will run the code and will have a breakpoint when MPI_Abort is encountered.
## Performance
Problems tend to show up in the 3D version if an algorithm has been implemented inefficiently. It is therefore highly recommended that a 3D test accompanies the implemented features.
### Computational
Computational bottlenecks can be inspected using Valgrind's tool `callgrind`. It is used as such
```
valgrind --tool=callgrind /home/ddong/Codes/PHiLiP/build_release/bin/2D_RBF_mesh_movement
```
This will result in a `callgrind.out.#####`. A visualizer such as `kcachegrind` (available through `apt`) can then be used to sort through the results. For example:
```kcachegrind callgrind.out.24250```
### Memory
Apart from memory leaks, it is possible that some required allocations demand too much memory. Valgrind also has a tool for this called `massif`. For example
```valgrind --tool=massif /home/ddong/Codes/PHiLiP/build_debug/bin/3D_RBF_mesh_movement```
will generate a `massif.out.#####` file that can be visualized using `massif-visualizer` (available through `apt`) as
```massif-visualizer massif.out.18580```
## Contributing checklist
1. A unit test, integration test, or regression test accompanies the feature. Tests longer than a few seconds should be tagged as with the suffix MEDIUM, and tests a minute or longer should be tagged with LONG.
* A unit test is often most appropriate, and is aimed at testing a single component of the code. See the test on [Euler's primitive to conservative conversion](https://github.com/dougshidong/PHiLiP/blob/master/tests/unit_tests/euler_unit_test/euler_convert_primitive_conservative.cpp)
* An integration test runs the entire main program by taking an input file and calling PHiLiP_1/2/3D. It should be derived from the [`TestBase` class](https://github.com/dougshidong/PHiLiP/blob/master/src/testing/tests.h), and have a control file located in the [integration test directory](https://github.com/dougshidong/PHiLiP/tree/master/tests/integration_tests_control_files). Since integrations tests uses multiple components, they usually take longer. Furthermore, the cause of failure is sometimes less obvious. A good suggestion is to use an existing test control file, and only change 1 parameter to help pinpoint issues when it fails.
* A regression test stores previously computed data to validate future results. Note that this type of test is rarely appropriate since valid changes in the code can fail this type of test. If implemented, a script/code should be made available such that newly computed results can replace the old results. See [file1](https://github.com/dougshidong/PHiLiP/blob/master/tests/unit_tests/regression/jacobian_matrix_regression.cpp) and [file2](https://github.com/dougshidong/PHiLiP/blob/master/tests/unit_tests/regression/matrix_data/copy_matrices.sh)
2. The feature has been documented.
* Function and member variable documentation should be presented in the associated header file. `make doc` should generate a html file in the `/path_to_build/doc/html/index.html` that can be opened used your browser of choice.
* Comments in the code as appropriate.
3. The `master` branch of `https://github.com/dougshidong/PHiLiP` has been merged into your fork and merge conflicts have been resolved.
4. The entire `ctest` suite has been run in `Release` mode and the short/medium length tests have been run in `Debug` mode (using `ctest -E LONG`). Please save the log for the next point.
5. Submit a pull request with a log of the tests.
# License
Expand Down
Loading

0 comments on commit 3ecd57f

Please sign in to comment.