Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 16 additions & 135 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,125 +9,10 @@ on:

workflow_dispatch:

jobs:
build-win:
name: Build Windows VS2022
runs-on: windows-2022
steps:
- name: 2.1. Obtaining OpenSees Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Microsoft Visual Studio
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: 2022
- name: Intel oneAPI Basic & HPC Toolkits
shell: pwsh
env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
WINDOWS_BASEKIT_COMPONENTS: intel.oneapi.win.mkl.devel
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe
WINDOWS_HPCKIT_COMPONENTS: "intel.oneapi.win.mpi.devel:intel.oneapi.win.ifort-compiler"
working-directory: D:\a\OpenSees\OpenSees\.github\workflows
run: |
./install_fortran.bat $env:WINDOWS_BASEKIT_URL $env:WINDOWS_BASEKIT_COMPONENTS
./install_fortran.bat $env:WINDOWS_HPCKIT_URL $env:WINDOWS_HPCKIT_COMPONENTS
- name: Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Conan 1.x
run: pip install conan<2.0
- name: MUMPS
shell: cmd
run: |
git clone https://github.com/OpenSees/mumps.git
cd mumps
mkdir build
cd build
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 mod
cmake .. -Darith=d -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -G Ninja
cmake --build . --config Release --parallel 4
- name: 2.2.2. Building the OpenSees Applications and Python module
shell: cmd
run: |
mkdir build
cd build
conan install .. --build missing --settings compiler="Visual Studio" --settings compiler.runtime="MT" --settings compiler.version=16
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 mod
cmake .. -DBLA_STATIC=ON -DMKL_LINK=static -DMKL_INTERFACE_FULL=intel_lp64 -DMUMPS_DIR="..\..\mumps\build"
cmake --build . --config Release --target OpenSees -j8
cmake --build . --config Release --target OpenSeesPy -j8
- name: Verification OpenSeesPySP
shell: pwsh
run: |
mv ./build/bin/OpenSeesPy.dll ./build/bin/opensees.pyd
cp "C:\Program Files (x86)\Intel\oneAPI\compiler\2024.1\bin\libiomp5md.dll" ./build/bin/
$env:PYTHONPATH = "./build/bin/"
python -c "import sys; print(sys.path)"
python ./EXAMPLES/ExamplePython/example_variable_analysis.py
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenSees_Windows
path: |
./build/bin/OpenSees.exe
./build/bin/opensees.pyd
./build/bin/libiomp5md.dll

build-mac:
name: Build Mac OS
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: 2.1. Obtaining OpenSees Source Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
# - name: XCode Command Line Tools is already installed.
- name: Install other dependencies via Homebrew
run: |
ln -s /opt/homebrew/bin/gcc-13 /usr/local/bin/gcc
ln -s /opt/homebrew/bin/gfortran-13 /usr/local/bin/gfortran
brew install eigen
brew install hdf5
brew install open-mpi
brew install scalapack
sudo ln -sf /opt/homebrew/include/eigen3/Eigen /opt/homebrew/include/Eigen
- name: MUMPS
run: |
git clone https://github.com/OpenSees/mumps.git
cd mumps
mkdir build
cd build
cmake .. -Darith=d
cmake --build . --config Release --parallel 4
- name: 2.3.2. Building the OpenSees Applications and Python module
run: |
mkdir build
cd build
cmake .. -DMUMPS_DIR=$PWD/../../mumps/build -DCMAKE_PREFIX_PATH=/usr/local/Cellar/libaec/1.1.3/cmake
cmake --build . --target OpenSees -j8
cmake --build . --target OpenSeesPy -j8
mv ./OpenSeesPy.dylib ./opensees.so
- name: Verification OpenSeesPySP
run: |
export PYTHONPATH="./build/"
python3 -c "import sys; print(sys.path)"
python3 ./EXAMPLES/ExamplePython/example_variable_analysis.py
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenSees_Mac
path: |
./build/OpenSees
./build/opensees.so
env:
PYTHONPATH: "./build/lib/:./mylib/"

jobs:
build-ubuntu:
name: Build Ubuntu
runs-on: ubuntu-latest
Expand All @@ -143,7 +28,13 @@ jobs:
python-version: "3.11"
# - name: Needed Applications and Libraries are already satisfied.
- name: Conan 1.x
run: pip install "conan<2.0"
run: pip install conan
- name: matplotlib
run: pip install matplotlib
- name: numpy
run: pip install numpy
# - name: scipy
# run: pip install scipy
- name: 2.4.2. Building the OpenSees Applications and Python module
run: |
mkdir build
Expand All @@ -152,26 +43,16 @@ jobs:
cmake ..
cmake --build . --target OpenSees -j8
cmake --build . --target OpenSeesPy -j8
mv lib/OpenSeesPy.so lib/opensees.so
cd lib
mkdir openseespy
mv OpenSeesPy.so openseespy/opensees.so
- name: Verification OpenSeesPySP # Simple Sanity Test
run: |
export PYTHONPATH="./build/lib/"
python3 -c "import sys; print(sys.path)"
python3 ./EXAMPLES/ExamplePython/example_variable_analysis.py
- name: Run pytest in tests/ folder
run: |
python3 -m pip install pytest
cp build/lib/opensees.so tests/
cd tests
pytest -v
xvfb-run python3 ./EXAMPLES/ExamplePython/example_ground_motion.py
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenSees_Ubuntu
path: |
./build/bin/OpenSees
./build/lib/opensees.so
# # Simple MP sanity test
# - name: Verification OpenSeesPyMP
# run: |
# mpiexec -np 2 python ../EXAMPLES/ExamplePython/example_mpi_paralleltruss_explicit.py
ground_motion.png
disp.out
32 changes: 32 additions & 0 deletions EXAMPLES/ExamplePython/example_ground_motion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import openseespy.opensees as ops
import numpy as np

# Create a basic model with a single node
ops.wipe()
ops.model('basic', '-ndm', 1, '-ndf', 1)
ops.node(1, 0.0); ops.fix(1, 1)
ops.node(2, 0.0); ops.mass(2, 1.0)
ops.uniaxialMaterial('Elastic', 1, 100.0)
ops.damping('Uniform', 1, 0.05, 1.0, 100.0)
ops.element('zeroLength', 1, 1, 2, '-mat', 1, '-dir', 1, '-damp', 1)
ops.timeSeries('Sine', 1, 0.0, 100.0, 0.628, '-factor', -10.0)
ops.pattern('UniformExcitation', 1, 1, '-accel', 1)
ops.analysis('Transient')
ops.recorder('Node', '-file', 'disp.out', '-time', '-node', 2, '-dof', 1, 'disp')

ops.analyze(1000, 0.01)

ops.wipe()
data = np.loadtxt('disp.out')
plt.figure()
plt.plot(data[:, 0], data[:, 1])
plt.xlabel('Time')
plt.ylabel('Displacement')
plt.grid()
plt.show()

#######
plt.savefig('./build/lib/ground_motion.png')
Loading