Skip to content

Commit

Permalink
Create librom header file (#80)
Browse files Browse the repository at this point in the history
* add get first columns to matrix header

* add rom to dg_advection partial

* add get first n columns and get truncated spatial basis

* fix test typos

* fix another test typo

* fix more build bugs

* test print

* more test prints

* Remove test prints

* fix bug

* remove member variables from basisreader

* remove matrix interpolater

* update qdeim to use vector

* make style

* typo

* update gnat,deim,qdeim tests

* remove test orig

* pass vector by reference

* fix typo

* add check to deim,gnat,qdeim

* add dg_advection rom example serial

* precompute a_inv

* remove num_rows from ROM_FE_Evolution

* matrix interpolation

* remove prints

* add basis interpolater

* make interpolater constructor protected

* separate out dg_advection and create dg_advection global rom

* put examples in different directories

* update path

* fix warnings

* make style

* update documentation

* remove old doc files

* update path

* add spack documentation

* add quotes to project brief

* rename files

* update cmake

* fix stylize

* add paper to doc

* move matlab and baseline directories

* update util imports

* rename greedy

* update gnat include

* fix deim include

* update svd path

* add api file

* add librom.h

* update svd include

* rename test

* move src to lib

* fix build

* rename baselines

* Update README.md

* remove debug tip

* update path

* add librom include test
  • Loading branch information
Kevin Huynh authored Nov 11, 2021
1 parent d459d9f commit 13dee16
Show file tree
Hide file tree
Showing 119 changed files with 500 additions and 372 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: ./.github/workflows/checkout_repo
- name: Build libROM
run: |
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
export CC=mpicc
export CXX=mpicxx
Expand All @@ -40,6 +41,7 @@ jobs:
- name: Build libROM
run: |
export FC=/usr/local/bin/gfortran-10
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
mpirun -n 3 --oversubscribe tests/test_RandomizedSVD
./tests/test_DMD
mpirun -n 3 --oversubscribe tests/test_DMD
./tests/test_GreedyParameterPointPreDefinedSampler
mpirun -n 3 --oversubscribe tests/test_GreedyParameterPointPreDefinedSampler
./tests/test_GreedyCustomSampler
mpirun -n 3 --oversubscribe tests/test_GreedyCustomSampler
shell: bash
18 changes: 0 additions & 18 deletions AUTHORS

This file was deleted.

119 changes: 3 additions & 116 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
#
###############################################################################

# Debugging tip: If using the GNU Make generator (the default), build
# with `make VERBOSE=1` to see flags being used by GNU Make. This
# output helps in trying to diagnose configuration errors. The
# equivalent for the Ninja generator is `ninja -v`. Also note that
# because this project "uses Fortran" -- a Fortran compiler is
# required to infer Fortran name-mangling conventions -- KitWare's
# "ninja-fortran" is needed to run the resulting Ninja files. This
# software can be installed, e.g., via Spack (`spack install
# ninja-fortran`).

# Require CMake version 3.12 or later to expose modern features of
# CMake for maintainability. With additional work, it is possible to
# rewrite the build system generator for CMake 3.10+, 3.8+, 3.1+,
Expand Down Expand Up @@ -46,9 +36,6 @@ list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH})
option(USE_MFEM "Build libROM with MFEM" OFF)
option(BUILD_STATIC "Build libROM as a static library" OFF)

include(FortranCInterface)
FortranCInterface_HEADER(${CMAKE_SOURCE_DIR}/FCMangle.h
MACRO_NAMESPACE "CAROM_FC_")
## Set a bunch of variables to generate a configure header
# Enable assertion checking if debug symbols generated
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR
Expand Down Expand Up @@ -106,87 +93,13 @@ if(HDF5_FOUND)
set(CAROM_HAVE_HDF5 1)
endif(HDF5_FOUND)

configure_file(${CMAKE_SOURCE_DIR}/CAROM_config.h.in
${CMAKE_SOURCE_DIR}/CAROM_config.h @ONLY)

# While it is tempting to use file globbing here, file globbing is
# considered a "modern CMake anti-pattern" because "CMake is not a
# build system -- it is a build system _generator_". Instead, use
# some file name "stems" for generating file names. This construction
# is useful when files may be moved to different directories.
set(module_list
Matrix
Vector
BasisGenerator
BasisReader
BasisWriter
SVD
IncrementalSVD
IncrementalSVDFastUpdate
IncrementalSVDStandard
StaticSVD
RandomizedSVD
GreedyParameterPointSampler
GreedyParameterPointRandomSampler
GreedyParameterPointPreDefinedSampler
Interpolator
MatrixInterpolator
VectorInterpolator
Database
HDFDatabase
Utilities
ParallelBuffer
DMD
DEIM
QDEIM
GNAT
STSampling)
set(source_files)
foreach(module IN LISTS module_list)
list(APPEND source_files ${module}.C)
endforeach(module) # IN LISTS module_list

list(APPEND source_files
Options.h)

if (USE_MFEM)
list(APPEND source_files
SampleMesh.hpp)
endif()

list(APPEND source_files
scalapack_c_wrapper.c
scalapack_f_wrapper.f90)
if (BUILD_STATIC)
add_library(ROM ${source_files})
else()
add_library(ROM SHARED ${source_files})
endif()

# List minimum version requirements for dependencies where possible to make
# packaging easier later.
find_package(HDF5 1.8.0 REQUIRED)

find_package(BLAS 3.4.0 REQUIRED)
find_package(LAPACK 3.4.0 REQUIRED)

# If MKL libraries not found, search for reference ScaLAPACK. If MKL
# libraries found, search for MKL ScaLAPACK; if MKL ScaLAPACK not
# found, search for reference ScaLAPACK. It seems that only
if (BLAS_LIBRARIES MATCHES ".*mkl.*")
find_package(MKL COMPONENTS BLACS ScaLAPACK)
if (NOT MKL_ScaLAPACK_FOUND)
find_package(ScaLAPACK REQUIRED)
target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES})
else()
target_link_libraries(ROM PUBLIC ${MKL_ScaLAPACK_LIBRARY} ${MKL_BLACS_LIBRARY} ${MKL_LIBRARIES})
target_include_directories(ROM PUBLIC ${MKL_INCLUDE_DIRS})
endif()
else() # BLAS or LAPACK isn't MKL
find_package(ScaLAPACK REQUIRED)
target_link_libraries(ROM PUBLIC ${ScaLAPACK_LIBRARIES})
endif()

# In FindMPI.cmake, "CXX" refers to "the MPI C API [being] usable from C++"
find_package(MPI 1.2 REQUIRED)

Expand All @@ -206,34 +119,7 @@ if (USE_MFEM)
find_path(PARMETIS_INCLUDES metis.h "${CMAKE_SOURCE_DIR}/dependencies/parmetis-4.0.3/metis/include")
endif()

# PUBLIC dependencies are transitive; these dependencies are used in
# the API headers *and* in their implementations
#
# INTERFACE dependencies are used in the API headers, but not in the
# API implementation (e.g., API forwards objects to another library
# without dereferencing those objects -- only pointers are used)
#
# PRIVATE dependencies are used in the API implementation, but not in
# the headers
#
# Using both the MPI::MPI_C target and the two MPI_C "flag variables
# (i.e., "MPI_C_LINK_FLAGS, MPI_C_LIBRARIES) is probably redundant,
# but is done here to ease a potential rollback to CMake 2.8 or CMake
# 3.0.
target_link_libraries(ROM
PUBLIC ${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES} MPI::MPI_C ${MPI_FORTRAN_LINK_FLAGS} ${MPI_FORTRAN_LIBRARIES} MPI::MPI_Fortran ${HDF5_LIBRARIES}
${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MFEM} ${HYPRE} ${PARMETIS} ${METIS}
PRIVATE ${ZLIB_LIBRARIES} ZLIB::ZLIB)

target_include_directories(ROM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${MFEM_INCLUDES}
${HYPRE_INCLUDES}
${PARMETIS_INCLUDES}
${HDF5_C_INCLUDE_DIRS}
${MPI_C_INCLUDE_DIRS}
${MFEM_C_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(lib)

# Use the C++11 standard as an entire feature instead of
# enumerating individual compiler features for simplicity
Expand Down Expand Up @@ -281,6 +167,7 @@ endif()

set(regression_test_names
smoke_test
test_include
uneven_dist
weak_scaling
random_test
Expand Down Expand Up @@ -312,7 +199,7 @@ if(GTEST_FOUND)
StaticSVD
RandomizedSVD
IncrementalSVD
GreedyParameterPointPreDefinedSampler)
GreedyCustomSampler)
foreach(stem IN LISTS unit_test_stems)
add_executable(test_${stem} tests/test_${stem}.C)
target_link_libraries(test_${stem} PRIVATE ROM
Expand Down
71 changes: 37 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,6 @@ non-intrusive black-box approaches.

- Sparse identification of nonlinear dynamics (SINDy)

# Authors
Robert W. Anderson (LLNL),
William Arrighi (LLNL),
Siu Wun Cheung (LLNL),
Youngsoo Choi (LLNL),
Dylan Copeland (LLNL),
Kevin Huynh (LLNL),
Jessica Lauzon (Stanford),
Sean McBane (UT Austin),
Geoffrey Oxberry (LLNL).

# License

libROM is distributed under the terms of both the MIT license and the
Apache License (Version 2.0). Users may choose either license at their
option.

All new contributions must be made under both the MIT and Apache-2.0 licenses.

See
[LICENSE-MIT](https://github.com/LLNL/libROM/blob/master/LICENSE-MIT),
[LICENSE-APACHE](https://github.com/LLNL/libROM/blob/master/LICENSE-APACHE),
[COPYRIGHT](https://github.com/LLNL/libROM/blob/master/COPYRIGHT), and
[NOTICE](https://github.com/LLNL/libROM/blob/master/NOTICE) for
details.

Up to commit 299876e0a0304f25db56f1f9e2eb2c61ef199048, libROM was
previously released under the terms of the BSD-3 license.

SPDX_License-Identifier: (Apache-2.0 OR MIT)

LLNL-CODE-686965 (up to commit 299876e0a0304f25db56f1f9e2eb2c61ef199048)
LLNL-CODE-766763

# Installation

To compile libROM with default build settings (Mac and LLNL LC Machines):
Expand Down Expand Up @@ -83,3 +49,40 @@ To install libROM with MFEM using spack.
```sh
spack install librom +mfem
```

# License

libROM is distributed under the terms of both the MIT license and the
Apache License (Version 2.0). Users may choose either license at their
option.

All new contributions must be made under both the MIT and Apache-2.0 licenses.

See
[LICENSE-MIT](https://github.com/LLNL/libROM/blob/master/LICENSE-MIT),
[LICENSE-APACHE](https://github.com/LLNL/libROM/blob/master/LICENSE-APACHE),
[COPYRIGHT](https://github.com/LLNL/libROM/blob/master/COPYRIGHT), and
[NOTICE](https://github.com/LLNL/libROM/blob/master/NOTICE) for
details.

Up to commit 299876e0a0304f25db56f1f9e2eb2c61ef199048, libROM was
previously released under the terms of the BSD-3 license.

SPDX_License-Identifier: (Apache-2.0 OR MIT)

LLNL-CODE-686965 (up to commit 299876e0a0304f25db56f1f9e2eb2c61ef199048)
LLNL-CODE-766763


# Authors
- Robert W. Anderson (LLNL)
- William Arrighi (LLNL)
- Kyle Chand (LLNL)
- Siu Wun Cheung (LLNL)
- Youngsoo Choi (LLNL)
- Dylan Copeland (LLNL)
- Kevin Huynh (LLNL)
- Tanya Kostova-Vassilevska (LLNL)
- Jessica Lauzon (Stanford)
- Sean McBane (UT Austin)
- Geoffrey Oxberry (LLNL)
Empty file removed build/.gitkeep
Empty file.
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/dmd/dg_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// are also illustrated.

#include "mfem.hpp"
#include "DMD.h"
#include "Vector.h"
#include "algo/DMD.h"
#include "linalg/Vector.h"
#include <cmath>
#include <fstream>
#include <iostream>
Expand Down
4 changes: 2 additions & 2 deletions examples/dmd/dg_euler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
// example.

#include "mfem.hpp"
#include "DMD.h"
#include "Vector.h"
#include "algo/DMD.h"
#include "linalg/Vector.h"
#include <cmath>
#include <fstream>
#include <sstream>
Expand Down
4 changes: 2 additions & 2 deletions examples/dmd/heat_conduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
// with ADIOS2 (adios2.readthedocs.io) is also illustrated.

#include "mfem.hpp"
#include "DMD.h"
#include "Vector.h"
#include "algo/DMD.h"
#include "linalg/Vector.h"
#include <cmath>
#include <fstream>
#include <iostream>
Expand Down
4 changes: 2 additions & 2 deletions examples/dmd/nonlinear_elasticity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
// requirement for high-order implicit (SDIRK) time integration.

#include "mfem.hpp"
#include "DMD.h"
#include "Vector.h"
#include "algo/DMD.h"
#include "linalg/Vector.h"
#include <memory>
#include <cmath>
#include <iostream>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/prom/dg_advection_global_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
// are also illustrated.

#include "mfem.hpp"
#include "Vector.h"
#include "BasisGenerator.h"
#include "BasisReader.h"
#include "linalg/Vector.h"
#include "linalg/BasisGenerator.h"
#include "linalg/BasisReader.h"
#include <cmath>
#include <set>
#include <fstream>
Expand Down
14 changes: 7 additions & 7 deletions examples/prom/dg_advection_local_rom_matrix_interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
// are also illustrated.

#include "mfem.hpp"
#include "Vector.h"
#include "MatrixInterpolator.h"
#include "VectorInterpolator.h"
#include "BasisGenerator.h"
#include "BasisReader.h"
#include "linalg/Vector.h"
#include "algo/manifold_interp/MatrixInterpolator.h"
#include "algo/manifold_interp/VectorInterpolator.h"
#include "linalg/BasisGenerator.h"
#include "linalg/BasisReader.h"
#include <cmath>
#include <set>
#include <fstream>
Expand Down Expand Up @@ -383,12 +383,12 @@ int main(int argc, char *argv[])
"Enable or disable matrix interpolation during the online phase.");
args.AddOption(&interp_prep, "-interp_prep", "--interp_prep", "-no-interp_prep", "--no-interp_prep",
"Enable or disable matrix interpolation preparation during the online phase.");
args.AddOption(&ef, "-ef", "--energy_fraction",
"Energy fraction.");
args.AddOption(&rbf_type, "-rt", "--rbf_type",
"RBF type ('G' == gaussian, 'MQ'== multiquadric, 'IQ' == inverse quadratic, 'IMQ' == inverse multiquadric).");
args.AddOption(&rbf_width, "-rw", "--rbf_width",
"RBF inverse width.");
args.AddOption(&ef, "-ef", "--energy_fraction",
"Energy fraction.");
args.AddOption(&rdim, "-rdim", "--rdim",
"Reduced dimension.");
args.Parse();
Expand Down
8 changes: 4 additions & 4 deletions examples/prom/mixed_nonlinear_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
#include <iostream>
#include <algorithm>

#include "BasisGenerator.h"
#include "BasisReader.h"
#include "DEIM.h"
#include "SampleMesh.hpp"
#include "linalg/BasisGenerator.h"
#include "linalg/BasisReader.h"
#include "hyperreduction/DEIM.h"
#include "mfem/SampleMesh.hpp"


typedef enum {ANALYTIC, INIT_STEP} PROBLEM;
Expand Down
Loading

0 comments on commit 13dee16

Please sign in to comment.