Commit 9c9dc53c authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

Merge branch 'feature' into 'master'

[432-define-iproblem] added UnitSquare - this stuff has to be cleaned up and...

See merge request mpp/mpp!443
parents 39248ee8 b6c8b94b
......@@ -3,7 +3,12 @@ build/
googletest/
cmake-build-debug/
cmake-build-default/
.directory
__pycache__/
notebooks/.ipynb_checkpoints/
/python/venv/*
softwipe*
\ No newline at end of file
*.synctex.gz
__pycache__/
.directory
softwipe*
*.log
*.aux
*.out
......@@ -96,15 +96,7 @@ mppytest-mpp:
tags: [ docker ]
trigger-tutorial:
stage: downstream
only:
variables:
- ($RUN_PROJECTS == "all" || $RUN_PROJECTS == "tutorial")
trigger:
project: mpp/tutorial
branch: feature
strategy: depend
# Todo include notebook jobs
trigger-mluq:
......@@ -125,7 +117,7 @@ trigger-cardmech:
- ($RUN_PROJECTS == "all" || $RUN_PROJECTS == "cardmech")
trigger:
project: mpp/cardmech
branch: debug
branch: feature
strategy: depend
......@@ -189,6 +181,6 @@ deploy-mpp:
- docker rmi ${MPP_REGISTRY}/${MPP_REGISTRY_REPO_DEV}/${IMAGE_NAME_MPP}
- docker rmi ${MPP_REGISTRY}/${MPP_REGISTRY_REPO_RELEASE}/mpp-${OS}${OS_VERSION}:${CI_COMMIT_TAG}
only: [ tags ]
dependencies: [ "ctest-mpp", "mpitest-mpp", "trigger-tutorial", "trigger-mluq",
dependencies: [ "ctest-mpp", "mpitest-mpp", "trigger-mluq",
"trigger-cardmech", "trigger-navierstokes", "trigger-spacetime", "trigger-dgwave", trigger-fwi]
tags: [ docker ]
This diff is collapsed.
# Macro to set an option for M++
MACRO(set_option OPT_NAME OPT_VALUE)
if (NOT DEFINED ${OPT_NAME})
set(${OPT_NAME} ${OPT_VALUE} CACHE STRING "OPT_NAME")
message(STATUS "Option: ${OPT_NAME}= $CACHE{${OPT_NAME}}")
else ()
message(STATUS "Option: ${OPT_NAME}= $CACHE{${OPT_NAME}} (using cached value)")
endif()
ENDMACRO()
MACRO(set_sub_option OPT_NAME SUB_OPT_NAME SUB_OPT_VALUE)
if (NOT DEFINED ${OPT_NAME})
message(FATAL_ERROR "Require option " ${OPT_NAME} " for sub option " ${SUB_OPT_NAME})
endif()
if (${OPT_NAME})
if (NOT DEFINED ${SUB_OPT_NAME})
set(${SUB_OPT_NAME} ${SUB_OPT_VALUE} CACHE STRING "SUB_OPT_NAME")
message(STATUS "Sub option: ${SUB_OPT_NAME}= $CACHE{${SUB_OPT_NAME}}")
else ()
message(STATUS "Sub option: ${SUB_OPT_NAME}= $CACHE{${SUB_OPT_NAME}} (using cached value)")
endif ()
else ()
set(${SUB_OPT_NAME} OFF CACHE STRING "SUB_OPT_NAME" FORCE)
if (${SUB_OPT_VALUE})
message(STATUS "Sub option: ${SUB_OPT_NAME}= $CACHE{${SUB_OPT_NAME}} (forced value; value was ${SUB_OPT_VALUE})")
else ()
message(STATUS "Sub option: ${SUB_OPT_NAME}= $CACHE{${SUB_OPT_NAME}} (forced value)")
endif ()
endif ()
ENDMACRO()
\ No newline at end of file
......@@ -13,9 +13,10 @@ USER ${USER}
COPY --chown=${USER}:${USER} . ${WORKDIR}
RUN mkdir -p build && \
cd build && \
cmake .. -DBUILD_TESTS=OFF && \
make -j && \
cmake .. -DBUILD_TESTS=ON -DUSE_CXSC=ON -DBUILD_IA_TESTS=ON -DUSE_SPACETIME=ON && \
cmake .. -DMPP_BUILD_TYPE=MppDebugFast -DBUILD_TESTS=ON \
-DUSE_CXSC=ON -DBUILD_IA_TESTS=ON -DUSE_SPACETIME=ON \
-DSPACE_DIM=3 -USE_FFTW=ON -USE_SPLITTED_COMMS=ON \
-DBUILD_TUTORIAL=ON -DBUILD_TUTORIAL_TESTS=ON && \
make -j
# Default to a login shell
......
FROM localhost:5000/mpp_dev_ubuntu:UBUNTUVERSION
MAINTAINER Mathias Reichardt <mathias.reichardt3@kit.edu>
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ARG USER=mpi
ENV USER ${USER}
ARG WORKDIR=/mpp
ENV WORKDIR ${WORKDIR}
WORKDIR ${WORKDIR}
USER ${USER}
COPY --chown=${USER}:${USER} . ${WORKDIR}
RUN mkdir -p build && \
cd build && \
cmake .. -DBUILD_TESTS=OFF -DUSE_CXSC=ON -DBUILD_IA_TESTS=OFF && \
make -j
# Default to a login shell
CMD ["bash", "-l"]
......@@ -137,60 +137,6 @@ class Mpp:
def clean_cmake_cache(self):
remove_file(self.dm.cmake_cache)
def set_cmake_arg(self, args):
# 1. Compiler options:
if args.CXX_VERSION is not None:
self.cmake_args.append('-CXX_VERSION={}'.format(args.CXX_VERSION))
if args.COMPILER_VERSION is not None:
self.cmake_args.append('-COMPILER_VERSION={}'.format(args.COMPILER_VERSION))
if args.COMPILER_OPTIMIZE is not None:
self.cmake_args.append('-COMPILER_OPTIMIZE={}'.format(args.COMPILER_OPTIMIZE))
if args.NO_DEPRECATED is not None:
self.cmake_args.append('-NO_DEPRECATED={}'.format(args.NO_DEPRECATED))
# 2. Problem options:
if args.SPACE_DIM is not None:
self.cmake_args.append('-SPACE_DIM={}'.format(args.SPACE_DIM))
# 3. Transformation options:
if args.AFFINE_LINEAR_TRAFO is not None:
self.cmake_args.append(
'-AFFINE_LINEAR_TRAFO={}'.format(args.AFFINE_LINEAR_TRAFO))
# 4. Constant options:
if args.CONST_GEOMETRIC_TOLERANCE is not None:
self.cmake_args.append(
'-CONST_GEOMETRIC_TOLERANCE={}'.format(args.CONST_GEOMETRIC_TOLERANCE))
if args.CONST_NEAR_ZERO is not None:
self.cmake_args.append('-CONST_NEAR_ZERO={}'.format(args.CONST_NEAR_ZERO))
if args.CONST_VERY_LARGE is not None:
self.cmake_args.append('-CONST_VERY_LARGE={}'.format(args.CONST_VERY_LARGE))
if args.CONST_INFTY is not None:
self.cmake_args.append('-CONST_INFTY={}'.format(args.CONST_INFTY))
# 5. Interval arithmetic options:
if args.USE_CXSC is not None:
self.cmake_args.append('-USE_CXSC={}'.format(args.USE_CXSC))
if args.BUILD_CXSC_TOOLBOX is not None:
self.cmake_args.append(
'-BUILD_CXSC_TOOLBOX={}'.format(args.BUILD_CXSC_TOOLBOX))
if args.BUILD_CXSC_EXAMPLES is not None:
self.cmake_args.append(
'-BUILD_CXSC_EXAMPLES={}'.format(args.BUILD_CXSC_EXAMPLES))
if args.BUILD_IA_VERIFY_QUAD is not None:
self.cmake_args.append(
'-BUILD_IA_VERIFY_QUAD={}'.format(args.BUILD_IA_VERIFY_QUAD))
# 6. Space time options:
if args.USE_SPACETIME is not None:
self.cmake_args.append('-USE_SPACETIME={}'.format(args.USE_SPACETIME))
# 7. Test options:
if args.BUILD_TESTS is not None:
self.cmake_args.append('-BUILD_TESTS={}'.format(args.BUILD_TESTS))
if args.BUILD_IA_TESTS is not None:
self.cmake_args.append('-BUILD_IA_TESTS={}'.format(args.BUILD_IA_TESTS))
def run_mpi_tests(self, kernels):
print('MPI Tests in project {}'.format(self.dm.PROJECT_BUILD_DIR))
rc_total = 0
......
start program on 4 procs at Tue Aug 11 17:30:59 2020
Config Info:
Problem: .................. Laplace2D
Meshes Info:
Mesh Name: ................ UnitSquare
......
......@@ -24,6 +24,12 @@ class TestLogParser(TestCase):
def test_parse_log(self):
df = pd.DataFrame(self.log_parser.parse_log(self.key_value_log))
# Todo This is a test for Bug reproduction: This should be Laplace2D
# Todo -> conversion of strings with digits is not working !
# Todo -> This has to be fixed with a new; cleaner parser
# Todo -> wasn't done as it as a minor bug
self.assertEqual(df.loc[0, 'Problem'], 2.0) # Laplace2D != 2.0
self.assertEqual(df.loc[0, 'Mesh Name'], 'UnitSquare')
self.assertEqual(df.loc[0, 'Level'], 6)
self.assertEqual(df.loc[0, 'Mesh width'], [0.015625, 0.015625])
......
......@@ -255,15 +255,15 @@ public:
if(z[0]== infty)
return 1;
if (hash == 0) {
if constexpr(SpaceDimension + TimeDimension == 1)
if constexpr(sDim + tDim == 1)
hash = size_t(115421.1 * z[0] + 345453 * GeometricTolerance);
else if constexpr(SpaceDimension + TimeDimension == 2)
else if constexpr(sDim + tDim == 2)
hash = size_t(115421.1 * z[0] + 124323.3 * z[1]
+ 345453 * GeometricTolerance);
else if constexpr(SpaceDimension + TimeDimension == 3)
else if constexpr(sDim + tDim == 3)
hash = size_t(115421.1 * z[0] + 124323.3 * z[1] + 221313.7 * z[2]
+ 345453 * GeometricTolerance);
else if constexpr(SpaceDimension + TimeDimension == 4)
else if constexpr(sDim + tDim == 4)
hash = size_t(115421.1 * z[0] + 124323.3 * z[1] + 221313.7 * z[2]
+ 3.7332 * z[3] + 345453 * GeometricTolerance);
}
......
......@@ -3,66 +3,84 @@
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
class Buffer {
private:
char *b;
char *b;
char *p;
char *p;
size_t n;
size_t n;
size_t max_n;
size_t max_n;
size_t BufferSize = 512000;
size_t BufferSize = 512000;
public:
Buffer(size_t m = 0);
Buffer(size_t m = 0);
~Buffer();
~Buffer();
void Destruct();
void Destruct();
size_t size() const;
size_t size() const;
size_t Size() const;
size_t Size() const;
void rewind();
void rewind();
char *operator()();
char *operator()();
void resize(size_t m);
void resize(size_t m);
template<typename T>
Buffer &fill(const T &type, size_t m) {
if (size() + m > n) {
size_t j = size_t(((size() + m) - n) / BufferSize) + 1;
resize(n + j * BufferSize);
}
memcpy(p, &type, m);
p += m; // Todo double check purpose
return *this;
}
template<typename T>
Buffer &read(T &type, size_t m) {
memcpy(&type, p, m);
p += m; // Todo double check purpose
return *this;
}
template<typename T>
Buffer &operator<<(const T &type) {
size_t m = sizeof(type);
return fill(type, m);
}
template<typename T>
Buffer &operator>>(T &type) {
size_t m = sizeof(type);
return read(type, m);
template<typename T>
Buffer &fill(const T &type, size_t m) {
if (size() + m > n) {
size_t j = size_t(((size() + m) - n) / BufferSize) + 1;
resize(n + j * BufferSize);
}
memcpy(p, &type, m);
p += m; // Todo double check purpose
return *this;
}
template<typename T>
Buffer &read(T &type, size_t m) {
memcpy(&type, p, m);
p += m; // Todo double check purpose
return *this;
}
template<typename T>
Buffer &operator<<(const T &type) {
size_t m = sizeof(type);
return fill(type, m);
}
template<typename T>
Buffer &operator>>(T &type) {
size_t m = sizeof(type);
return read(type, m);
}
template<typename T>
Buffer &operator<<(const std::vector<T> &vec) {
*this << vec.size();
for (auto &entry: vec) *this << entry;
return *this;
}
template<typename T>
Buffer &operator>>(std::vector<T> &vec) {
size_t size;
*this >> size;
vec.resize(size);
for (int i = 0; i < size; i++) *this >> vec[i];
return *this;
}
};
#endif //BUFFER_HPP
......@@ -405,8 +405,6 @@ string Config::getDataPath() {
return Config::dataPath;
}
int DebugLevel;
int TimeLevel;
int MuteLevel;
......
......@@ -127,6 +127,25 @@ MLogging::MLogging() {
config.get("enableFileLogging", fileEnabled, true);
config.get("enableScreenLogging", screenEnabled, true);
if (name.substr(0, 17) == "UseConfigEntries[" && name.back() == ']') {
if (name.size() > 18) {
std::vector<std::string> keys = split(name.substr(17, name.size() - 18), ",");
if (keys.empty()) {
name = "log/log";
} else {
name = "log/";
}
for (auto key : keys) {
std::string value;
config.get(key, value);
name.append(value).append("_");
}
name.erase(name.end()-1);
} else {
name = "log/log";
}
}
if (onMaster) {
char env[100];
......
......@@ -389,10 +389,6 @@ Logging &operator<<(Logging &s, const std::unordered_map<P, C, H> &M) {
#define MOUT(s) mout << OUT(s) << std::endl;
extern int DebugLevel;
#define dout(i) if (DebugLevel >= i) mout
#define pout Logging::instanceP()
#define pvout(i) if (verbose >= i) pout
......@@ -401,8 +397,6 @@ extern int DebugLevel;
#define vpout(i) if (verbose >= i) pout
#define dpout(i) if (DebugLevel >= i) pout
#define ppout(s) if (PPM->proc() == s) pout
#endif //LOGGING_HPP
......@@ -51,9 +51,9 @@ template<typename REAL>
RMatrixT<REAL> &RMatrixT<REAL>::transpose() {
RMatrixT<REAL> b(*this);
this->resize(b.Ncols, b.Nrows);
for (int i = 0; i < Nrows; ++i)
for (int j = 0; j < Ncols; ++j)
z[i * Ncols + j] = b[j][i];
for (int i = 0; i < Ncols; ++i)
for (int j = 0; j < Nrows; ++j)
(*this)[j][i] = b[i][j];
return *this;
}
......@@ -103,22 +103,22 @@ RMatrixT<double> &RMatrixT<double>::Exp() {
int q = 1;
if (delta >= 1.0 / 1440) {
q = 2;
dout(10) << "q = 2: eps = " << 1.0 / 1440 << "\n";
// dout(10) << "q = 2: eps = " << 1.0 / 1440 << "\n";
} else if (delta >= 1.0 / 806400) {
q = 3;
dout(10) << "q = 3: eps = " << 1.0 / 806400 << "\n";
// dout(10) << "q = 3: eps = " << 1.0 / 806400 << "\n";
} else if (delta >= 1.0 / 812851200) {
q = 4;
dout(10) << "q = 4: eps = " << 1.0 / 812851200 << "\n";
// dout(10) << "q = 4: eps = " << 1.0 / 812851200 << "\n";
} else if (delta >= 7.76665066513e-13) {
q = 5;
dout(10) << "q = 5: eps = " << 7.76665066513e-13 << "\n";
// dout(10) << "q = 5: eps = " << 7.76665066513e-13 << "\n";
} else if (delta >= 3.39451515084e-16) {
q = 6;
dout(10) << "q = 6: eps = " << 3.39451515084e-16 << "\n";
// dout(10) << "q = 6: eps = " << 3.39451515084e-16 << "\n";
} else if (delta >= 1.08798562527e-19) {
q = 7;
dout(10) << "q = 6: eps = " << 1.08798562527e-19 << "\n";
// dout(10) << "q = 6: eps = " << 1.08798562527e-19 << "\n";
} else
THROW("exp: Selected accuracy unrealistic; file: Tensor.h\n")
......@@ -141,6 +141,55 @@ RMatrixT<double> &RMatrixT<double>::Exp() {
for (int k = 1; k <= int(j); ++k) *this = (*this) * (*this);
return *this;
}
template<>
RMatrixT<double> &RMatrixT<double>::Phi1() {
int K = (*this).rows();
RMatrix XX(2 * K, 2 * K);
for (int k = 0; k < K; ++k) {
XX[k][K + k] = 1;
for (int l = 0; l < K; ++l) {
XX[K + k][K + l] = (*this)[k][l];
}
}
XX.Exp();
for (int k = 0; k < K; ++k)
for (int l = 0; l < K; ++l)
(*this)[k][l] = XX[k][K + l];
return *this;
}
template<>
RMatrixT<double> &RMatrixT<double>::Phi2(){
int K = (*this).rows();
RMatrix XX(2*K,2*K);
for (int k=0; k<K; ++k) {
XX[k][K+k] =1;
for (int l=0; l<K; ++l){
XX[K+k][K+l] = (*this)[k][l];
}
}
XX.Phi1();
for (int k=0; k<K; ++k)
for (int l=0; l<K; ++l)
(*this)[k][l] = XX[k][K+l];
return *this;
}
template<>
RMatrixT<double> &RMatrixT<double>::Phi3() {
int K = (*this).rows();
RMatrix XX(2 * K, 2 * K);
for (int k = 0; k < K; ++k) {
XX[k][K + k] = 1;
for (int l = 0; l < K; ++l) {
XX[K + k][K + l] = (*this)[k][l];
}
}
XX.Phi2();
for (int k = 0; k < K; ++k)
for (int l = 0; l < K; ++l)
(*this)[k][l] = XX[k][K + l];
return *this;
}
template<typename REAL>
void RMatrixT<REAL>::SaddlePoint(const RMatrixT<REAL> &A, const RMatrixT<REAL> &B) {
......
......@@ -311,6 +311,13 @@ public:
RMatrixT<REAL> &Exp();
RMatrixT<REAL> &Phi1();
RMatrixT<REAL> &Phi2();
RMatrixT<REAL> &Phi3();
void SaddlePoint(const RMatrixT &A, const RMatrixT &B);
Saver &save(Saver &saver) const;
......
......@@ -151,6 +151,18 @@ void SparseRMatrixT<REAL>::changeToDiagonal(int j) {
col = colcol;
}
template<typename REAL>
REAL SparseRMatrixT<REAL>::leftAndRightProduct(const REAL *b, const REAL *u) const {
REAL prod = 0.0;
for (int row = 0; row < Nrows; ++row){
for (int k = d[row]; k < d[row + 1]; ++k){
prod += b[row] * a[k] * u[col[k]];
}
}
return prod;
}
template
class SparseRMatrixT<double>;
......@@ -158,4 +170,4 @@ class SparseRMatrixT<double>;
template
class SparseRMatrixT<IAInterval>;
#endif
\ No newline at end of file
#endif
......@@ -2,6 +2,7 @@
#define SPARSERMATRIX_HPP
#include "RMatrix.hpp"
#include "GlobalDefinitions.hpp"
#ifdef BUILD_IA
......@@ -43,6 +44,7 @@ class SparseRMatrixT {
protected:
void SetComputedNcols();
REAL leftAndRightProduct(const REAL *b, const REAL *u) const;
public:
template<typename REAL1>
......
......@@ -97,7 +97,7 @@ class SuperSolver : public SparseSolver {
THROW("Error in superLU: " + std::to_string(-info) + "-th argument had an illegal value")
} else {
if (info <= AC.ncol) {
Exit("Error in superLU: A(" + std::to_string(info) + "," + std::to_string(info)
THROW("Error in superLU: A(" + std::to_string(info) + "," + std::to_string(info)
+ " is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.")
} else {
THROW("Error in superLU: number of bytes allocated when memory allocation failure occurred")
......
......@@ -12,7 +12,7 @@
#include "Hexahedron.hpp"
#endif
#if USE_SPACETIME
#ifdef USE_SPACETIME
#include "TCell.hpp"
#endif
......@@ -43,7 +43,7 @@ Cell *CreateCell(CELLTYPE tp, int flag, const vector<Point> &z, bool checkOrient
if (tp == HEXAHEDRON20) return new Hexahedron20(z, flag, checkOrientation);
if (tp == HEXAHEDRON27) return new Hexahedron27(z, flag, checkOrientation);
#endif
#if USE_SPACETIME
#ifdef USE_SPACETIME
if (tp == SPACETIME_INTERVAL) {
Cell *c = CreateCell(INTERVAL, flag, z);
......@@ -73,7 +73,7 @@ const Cell *ReferenceCell(CELLTYPE tp) {
case HEXAHEDRON:
return Hexahedron::ReferenceHexahedron();
#endif
#if USE_SPACETIME
#ifdef USE_SPACETIME
case SPACETIME_INTERVAL:
return ReferenceCell(SpaceCellType(SPACETIME_INTERVAL));
case SPACETIME_QUADRILATERAL:
......
Markdown is supported
0% or .