Skip to content

Commit 07ee5d8

Browse files
committed
Merge branch 'develop' into feature/macOS_M1_support
2 parents cc551c4 + 680ae3c commit 07ee5d8

34 files changed

+1018
-284
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
# Check for updates to GitHub Actions every week
12+
interval: "weekly"

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- Add a short description of your contribution here. Skip this if the title is self-explanatory -->
2+
3+
Checklist:
4+
5+
- [ ] I made sure that the CI passed before I ask for a review.
6+
- [ ] I added a summary of the changes (compared to the last release) in the `CHANGELOG.md`.
7+
- [ ] If necessary, I made changes to the documentation and/or added new content.
8+
- [ ] I will remember to squash-and-merge, providing a useful summary of the changes of this PR.

.github/workflows/clang-format-check.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/test_pyfans.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test PyFans
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
pyfans-run-test:
7+
runs-on: ubuntu-latest
8+
container: unistuttgartdae/fans-ci:noble
9+
defaults:
10+
run:
11+
shell: "bash --login -eo pipefail {0}"
12+
env:
13+
FANS_BUILD_DIR: build
14+
FANS_MPI_USER: fans
15+
steps:
16+
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
- name: Generate build directory
21+
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
22+
23+
- name: Install dependencies
24+
run: |
25+
apt update
26+
apt install -y cmake make g++ python3 python3-numpy python3.12-dev
27+
28+
- name: Configure
29+
working-directory: ${{ env.FANS_BUILD_DIR }}
30+
run: |
31+
cmake .. -DFANS_LIBRARY_FOR_MICRO_MANAGER=ON
32+
make
33+
34+
- name: Run FANS as a library via a Python script
35+
run: |
36+
cd test/test_pyfans
37+
python3 run_fans_as_library.py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ test/input_files/**/*.json
198198
**/scratch/
199199

200200
# Test microstructure files
201-
!sphere.h5
201+
!sphere32.h5
202202

203203
# Test input files
204204
!test_LinearElastic.json

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ repos:
1616
- id: black
1717
# clang-format for C/C++ formatting
1818
- repo: https://github.com/pre-commit/mirrors-clang-format
19-
rev: v8.0.1
19+
rev: v19.1.2
2020
hooks:
2121
- id: clang-format
2222
args: ['--style=file']
2323
exclude: "include/json.hpp"
24+
types_or: [c++]

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# FANS Changelog
22

3+
## latest
4+
5+
- Modify way to provide micro structure in JSON input https://github.com/DataAnalyticsEngineering/FANS/pull/43
6+
- Add conda package for FANS https://github.com/DataAnalyticsEngineering/FANS/pull/39
7+
- Introduce system for checking compiler flags: `avx2` & `fma` https://github.com/DataAnalyticsEngineering/FANS/pull/34
8+
- Add `results_prefix` field in the JSON input https://github.com/DataAnalyticsEngineering/FANS/pull/36
9+
- Build FANS as a library to be coupled to a macro-scale simulation via preCICE and the Micro Manager https://github.com/DataAnalyticsEngineering/FANS/pull/23
10+
11+
## v0.3.0
12+
13+
- Added Linear thermal and mechanical triclinic material models https://github.com/DataAnalyticsEngineering/FANS/pull/32
14+
- Added API to get homogenized stress and homogenized tangent https://github.com/DataAnalyticsEngineering/FANS/pull/31
15+
316
## v0.2.0
417

518
- Add integration tests https://github.com/DataAnalyticsEngineering/FANS/pull/20

CMakeLists.txt

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.0...3.28)
55
# ##############################################################################
66

77
project(FANS
8-
VERSION 0.2.0
8+
VERSION 0.3.0
99
LANGUAGES C CXX
1010
)
1111

@@ -92,6 +92,17 @@ find_package(MPI REQUIRED)
9292

9393
find_package(FFTW3 REQUIRED COMPONENTS DOUBLE MPI)
9494

95+
option(FANS_LIBRARY_FOR_MICRO_MANAGER "Building FANS as a library to be used by the Micro Manager." OFF)
96+
97+
if (FANS_LIBRARY_FOR_MICRO_MANAGER)
98+
include(FetchContent)
99+
FetchContent_Declare(
100+
pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git
101+
GIT_TAG v2.12.0
102+
)
103+
FetchContent_MakeAvailable(pybind11)
104+
endif()
105+
95106
# ##############################################################################
96107
# TARGETS
97108
# ##############################################################################
@@ -107,8 +118,36 @@ add_library(FANS::FANS ALIAS FANS_FANS)
107118
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
108119
target_compile_options(FANS_FANS PUBLIC -march=armv8-a+simd+fp+crypto)
109120
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
110-
target_compile_options(FANS_FANS PUBLIC -mavx2 -mfma)
111-
endif ()
121+
# Detecting if there is avx2 and fma support on linux
122+
# Deteced together, because these flags were introduced by Intel Haskell 4th. Gen
123+
# Distinguishing between mac/linux because lscpu is used, which is not supported on mac.
124+
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
125+
# macOS: Assume AVX2 and FMA are supported as per requirement
126+
message(STATUS "Assuming AVX2 and FMA support on macOS; using -mavx2 and -mfma.")
127+
target_compile_options(FANS_FANS PUBLIC -mavx2 -mfma)
128+
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
129+
# Linux: Check for AVX2 support using lscpu
130+
execute_process(COMMAND lscpu OUTPUT_VARIABLE LSCPU_OUTPUT ERROR_QUIET)
131+
132+
# Default to AVX; enable AVX2 if supported by hardware
133+
set(FANS_USE_AVX2 FALSE)
134+
if (LSCPU_OUTPUT MATCHES "avx2")
135+
set(FANS_USE_AVX2 TRUE)
136+
endif()
137+
138+
# Apply compiler options based on hardware detection
139+
if (FANS_USE_AVX2)
140+
message(STATUS "AVX2 and FMA supported by hardware; using -mavx2 and -mfma.")
141+
target_compile_options(FANS_FANS PUBLIC -mavx2 -mfma)
142+
else()
143+
message(WARNING "AVX2 and FMA not supported by hardware; falling back to AVX.")
144+
target_compile_options(FANS_FANS PUBLIC -mavx)
145+
endif()
146+
else()
147+
message(WARNING "Unsupported system for AVX2 detection; defaulting to -mavx.")
148+
target_compile_options(FANS_FANS PUBLIC -mavx)
149+
endif()
150+
endif()
112151

113152
add_executable(FANS_main)
114153
add_custom_command(
@@ -120,6 +159,10 @@ add_custom_command(
120159
COMMENT "Create a symlink for FANS executable to ${CMAKE_CURRENT_SOURCE_DIR}/test/"
121160
)
122161

162+
if (FANS_LIBRARY_FOR_MICRO_MANAGER)
163+
add_subdirectory(pyfans)
164+
endif ()
165+
123166
# ##############################################################################
124167
# HEADERS
125168
# ##############################################################################
@@ -138,8 +181,8 @@ set_property(TARGET FANS_FANS PROPERTY PUBLIC_HEADER
138181
include/solver.h
139182
include/setup.h
140183

141-
include/material_models/LinearThermalIsotropic.h
142-
include/material_models/LinearElasticIsotropic.h
184+
include/material_models/LinearThermal.h
185+
include/material_models/LinearElastic.h
143186
include/material_models/PseudoPlastic.h
144187
include/material_models/J2Plasticity.h
145188
)

0 commit comments

Comments
 (0)