Merge branch 'clean-CI' into development

This commit is contained in:
Martin Diehl 2021-11-16 23:38:14 +01:00
commit 59b6b4bb2b
4 changed files with 82 additions and 59 deletions

View File

@ -3,20 +3,18 @@ stages:
- prepare - prepare
- python - python
- compile - compile
- setup
- fortran - fortran
- performance - performance
- deploy - deploy
- update_master - finalize
################################################################################################### ###################################################################################################
default: default:
before_script: before_script:
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} - ${LOCAL_HOME}/bin/queue ${CI_JOB_ID}
- source $DAMASKROOT/env/DAMASK.sh - source env/DAMASK.sh
- export PATH=${TESTROOT}/bin:$PATH - export PATH=${TESTROOT}/bin:${PATH}
- cd $DAMASKROOT/PRIVATE/testing
- echo Job start:" $(date)" - echo Job start:" $(date)"
after_script: after_script:
- echo Job end:" $(date)" - echo Job end:" $(date)"
@ -33,20 +31,19 @@ variables:
# Shortcut names # Shortcut names
# =============================================================================================== # ===============================================================================================
TESTROOT: "$LOCAL_HOME/GitLabCI_Pipeline_$CI_PIPELINE_ID" TESTROOT: "$LOCAL_HOME/GitLabCI_Pipeline_$CI_PIPELINE_ID"
DAMASKROOT: "$LOCAL_HOME/GitLabCI_Pipeline_$CI_PIPELINE_ID/DAMASK"
# =============================================================================================== # ===============================================================================================
# Names of module files to load # Names of module files to load
# =============================================================================================== # ===============================================================================================
# ++++++++++++ Compiler +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # ++++++++++++ Compiler +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IntelCompiler: "Compiler/Intel/19.1.2 Libraries/IMKL/2020" COMPILER_INTEL: "Compiler/Intel/19.1.2 Libraries/IMKL/2020"
GNUCompiler: "Compiler/GNU/10" COMPILER_GNU: "Compiler/GNU/10"
# ++++++++++++ MPI ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # ++++++++++++ MPI ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MPI_Intel: "MPI/Intel/19.1.2/IntelMPI/2019" MPI_INTEL: "MPI/Intel/19.1.2/IntelMPI/2019"
MPI_GNU: "MPI/GNU/10/OpenMPI/4.1.1" MPI_GNU: "MPI/GNU/10/OpenMPI/4.1.1"
# ++++++++++++ PETSc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # ++++++++++++ PETSc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PETSc_Intel: "Libraries/PETSc/3.16.1/Intel-19.1.2-IntelMPI-2019" PETSC_INTEL: "Libraries/PETSc/3.16.1/Intel-19.1.2-IntelMPI-2019"
PETSc_GNU: "Libraries/PETSc/3.16.1/GNU-10-OpenMPI-4.1.1" PETSC_GNU: "Libraries/PETSc/3.16.1/GNU-10-OpenMPI-4.1.1"
# ++++++++++++ MSC Marc +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # ++++++++++++ MSC Marc +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MSC: "FEM/MSC/2021.2" MSC: "FEM/MSC/2021.2"
IntelMarc: "Compiler/Intel/19.1.2 Libraries/IMKL/2020" IntelMarc: "Compiler/Intel/19.1.2 Libraries/IMKL/2020"
@ -54,97 +51,107 @@ variables:
################################################################################################### ###################################################################################################
checkout: create_testroot:
stage: prepare stage: prepare
before_script: before_script:
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} - ${LOCAL_HOME}/bin/queue ${CI_JOB_ID}
- echo Job start:" $(date)" - echo Job start:" $(date)"
script: script:
- mkdir -p ${DAMASKROOT} - mkdir -p ${TESTROOT}
- cd ${DAMASKROOT}
- git clone -q git@git.damask.mpie.de:damask/DAMASK.git .
- git checkout ${CI_COMMIT_SHA}
- git submodule update --init
################################################################################################### ###################################################################################################
pytest: pytest:
stage: python stage: python
script: script:
- PYTHONPATH=${CI_PROJECT_DIR}/python - cd python
- cd ${CI_PROJECT_DIR}/python
- pytest --basetemp ${TESTROOT}/python -v --cov --cov-report=term - pytest --basetemp ${TESTROOT}/python -v --cov --cov-report=term
- coverage report --fail-under=90 - coverage report --fail-under=90
mypy: mypy:
stage: python stage: python
script: script:
- cd ${CI_PROJECT_DIR}/python - cd python
- mypy damask - mypy damask
################################################################################################### ###################################################################################################
compile_grid_Intel: test_grid_Intel:
stage: compile stage: compile
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'compile and grid' --basetemp ${TESTROOT}/compile_grid_Intel - pytest -k 'compile and grid' --basetemp ${TESTROOT}/compile_grid_Intel
compile_mesh_Intel: test_mesh_Intel:
stage: compile stage: compile
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'compile and mesh' --basetemp ${TESTROOT}/compile_mesh_Intel - pytest -k 'compile and mesh' --basetemp ${TESTROOT}/compile_mesh_Intel
compile_grid_GNU: test_grid_GNU:
stage: compile stage: compile
script: script:
- module load $GNUCompiler $MPI_GNU $PETSc_GNU - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU}
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'compile and grid' --basetemp ${TESTROOT}/compile_grid_GNU - pytest -k 'compile and grid' --basetemp ${TESTROOT}/compile_grid_GNU
compile_mesh_GNU: test_mesh_GNU:
stage: compile stage: compile
script: script:
- module load $GNUCompiler $MPI_GNU $PETSc_GNU - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU}
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'compile and mesh' --basetemp ${TESTROOT}/compile_mesh_GNU - pytest -k 'compile and mesh' --basetemp ${TESTROOT}/compile_mesh_GNU
compile_Marc: test_Marc:
stage: compile stage: compile
script: script:
- module load $IntelMarc $HDF5Marc $MSC - module load $IntelMarc $HDF5Marc $MSC
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'compile and Marc' --basetemp ${TESTROOT}/compile_Marc - pytest -k 'compile and Marc' --basetemp ${TESTROOT}/compile_Marc
###################################################################################################
setup_grid: setup_grid:
stage: setup stage: compile
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd $(mktemp -d) - cd $(mktemp -d)
- cmake -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${TESTROOT} ${CI_PROJECT_DIR} - cmake -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${TESTROOT} ${CI_PROJECT_DIR}
- make -j2 all install - make -j2 all install
setup_mesh: setup_mesh:
stage: setup stage: compile
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd $(mktemp -d) - cd $(mktemp -d)
- cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${TESTROOT} ${CI_PROJECT_DIR} - cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${TESTROOT} ${CI_PROJECT_DIR}
- make -j2 all install - make -j2 all install
compile_Marc:
stage: compile
script:
- module load $IntelMarc $HDF5Marc $MSC
- cd $(mktemp -d)
- cp ${CI_PROJECT_DIR}/examples/Marc/* .
- python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')"
- mkdir ${TESTROOT}/src
- mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc ${TESTROOT}/src
################################################################################################### ###################################################################################################
core: open-source:
stage: fortran stage: fortran
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd pytest - cd PRIVATE/testing/pytest
- pytest -k 'not compile' --basetemp ${TESTROOT}/fortran -v - pytest -k 'not compile and not Marc' --basetemp ${TESTROOT}/open-source -v
Marc:
stage: fortran
script:
- cd PRIVATE/testing/pytest
- pytest -k 'not compile and Marc' --damask-root=${TESTROOT} --basetemp ${TESTROOT}/Marc -v
# Needs closer look # Needs closer look
# Phenopowerlaw_singleSlip: # Phenopowerlaw_singleSlip:
@ -156,20 +163,25 @@ core:
grid_runtime: grid_runtime:
stage: performance stage: performance
script: script:
- module load $IntelCompiler $MPI_Intel $PETSc_Intel - module load ${COMPILER_INTEL} ${MPI_INTEL} ${PETSC_INTEL}
- cd $(mktemp -d) - cd $(mktemp -d)
- cmake -DOPTIMIZATION=AGGRESSIVE -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${TESTROOT} ${CI_PROJECT_DIR} - cmake -DOPTIMIZATION=AGGRESSIVE -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=./ ${CI_PROJECT_DIR}
- make -j2 all install - make -j2 all install
- cd $(mktemp -d) - export PATH=${PWD}/bin:${PATH}
- git clone -q git@git.damask.mpie.de:damask/performance.git . - REPO_DIR=$(mktemp -d)
- ${DAMASKROOT}/PRIVATE/testing/runtime.py --input_dir $DAMASKROOT/examples/grid --output_dir . --tag ${CI_COMMIT_SHA} - git clone -q git@git.damask.mpie.de:damask/performance.git ${REPO_DIR}
- >
${CI_PROJECT_DIR}/PRIVATE/testing/runtime.py
--input_dir ${CI_PROJECT_DIR}/examples/grid
--output_dir ${REPO_DIR}
--tag ${CI_COMMIT_SHA}
- if [ ${CI_COMMIT_BRANCH} == development ]; then git commit -am ${CI_PIPELINE_ID}_${CI_COMMIT_SHA}; git push; fi - if [ ${CI_COMMIT_BRANCH} == development ]; then git commit -am ${CI_PIPELINE_ID}_${CI_COMMIT_SHA}; git push; fi
before_script: before_script:
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} --blocking - ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} --blocking
- source $DAMASKROOT/env/DAMASK.sh - source env/DAMASK.sh
- export PATH=${TESTROOT}/bin:$PATH
- echo Job start:" $(date)" - echo Job start:" $(date)"
################################################################################################### ###################################################################################################
source_distribution: source_distribution:
stage: deploy stage: deploy
@ -179,10 +191,14 @@ source_distribution:
################################################################################################### ###################################################################################################
merge_into_master: update_revision:
stage: update_master stage: finalize
before_script:
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID}
- echo Job start:" $(date)"
script: script:
- cd ${DAMASKROOT} - cd $(mktemp -d)
- git clone -q git@git.damask.mpie.de:damask/DAMASK.git .
- export TESTEDREV=$(git describe) # might be detached from development branch - export TESTEDREV=$(git describe) # might be detached from development branch
- echo ${TESTEDREV} > python/damask/VERSION - echo ${TESTEDREV} > python/damask/VERSION
- git add python/damask/VERSION - git add python/damask/VERSION

@ -1 +1 @@
Subproject commit ee4b1a03b443a2c497a13c45c9498313442d731e Subproject commit 277b4a693a57c1e4583bcf8ea2205f9b5d147198

View File

@ -49,9 +49,8 @@ def patch_plt_show(monkeypatch):
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--update", parser.addoption('--update', action='store_true', default=False,
action="store_true", help='Update reference results.')
default=False)
@pytest.fixture @pytest.fixture

View File

@ -989,11 +989,19 @@ class TestRotation:
with pytest.raises(TypeError): with pytest.raises(TypeError):
R@data R@data
def test_misorientation(self): def test_misorientation_invariant(self):
R = Rotation.from_random() R = Rotation.from_random()
assert np.allclose(R.misorientation(R).as_matrix(),np.eye(3)) assert np.allclose(R.misorientation(R).as_matrix(),np.eye(3))
def test_misorientation360(self): def test_misorientation_average(self):
"""2 times the average is the misorientation."""
r = Rotation.from_random(2)
a = r[0].misorientation(r[1]).as_axis_angle()
b = r.average().misorientation(r[1]).as_axis_angle()
b[3] = (b[3]*2)%np.pi
assert np.allclose(a,b)
def test_misorientation_360deg(self):
R_1 = Rotation() R_1 = Rotation()
R_2 = Rotation.from_Euler_angles([360,0,0],degrees=True) R_2 = Rotation.from_Euler_angles([360,0,0],degrees=True)
assert np.allclose(R_1.misorientation(R_2).as_matrix(),np.eye(3)) assert np.allclose(R_1.misorientation(R_2).as_matrix(),np.eye(3))