Skip to content

Commit

Permalink
Merge branch 'main' into release/0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhuiuy committed Jan 4, 2024
2 parents 9d68fb7 + e994751 commit 2fd67a8
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 105 deletions.
36 changes: 17 additions & 19 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main

env:
MAIN_PYTHON_VERSION: '3.9'
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'ansys-dyna-core'
PACKAGE_NAMESPACE: 'ansys.dyna.core'
DOCUMENTATION_CNAME: "dyna.docs.pyansys.com"
Expand All @@ -24,7 +24,7 @@ jobs:
name: "Code style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/code-style@v4
- uses: ansys/actions/code-style@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v4
uses: ansys/actions/doc-style@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -87,14 +87,14 @@ jobs:
make -C doc pdf
- name: "Upload html documentation"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: doc/_build/html
retention-days: 7

- name: "Upload pdf documentation"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: doc/_build/latex/*.pdf
Expand All @@ -107,9 +107,9 @@ jobs:
- name: "Upload the server logs"
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: server_output.txt
name: server_output_docs.txt
path: server_output.txt

- name: DPF Logs (on screen)
Expand All @@ -126,12 +126,11 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: ansys/actions/build-wheelhouse@v4
- uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
library-namespace: ${{ env.PACKAGE_NAMESPACE }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -177,13 +176,13 @@ jobs:
- name: "Upload the server logs"
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: server_output.txt
name: server_output_tests.txt
path: server_output.txt

- name: "Upload coverage results"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: .cov/html
Expand All @@ -194,7 +193,7 @@ jobs:
needs: [doc, tests]
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/build-library@v4
- uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
Expand All @@ -206,14 +205,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Release to the public PyPI repository"
uses: ansys/actions/release-pypi-public@v4
uses: ansys/actions/release-pypi-public@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}

- name: "Release to GitHub"
uses: ansys/actions/release-github@v4
uses: ansys/actions/release-github@v5
with:
library-name: ${{ env.PACKAGE_NAME }}

Expand All @@ -223,7 +222,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build-library]
steps:
- uses: ansys/actions/doc-deploy-dev@v4
- uses: ansys/actions/doc-deploy-dev@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -234,8 +233,7 @@ jobs:
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: ansys/actions/doc-deploy-stable@v4
- uses: ansys/actions/doc-deploy-stable@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
52 changes: 52 additions & 0 deletions doc/source/getting-started/SERVER_PRE_README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Start PyDYNA preprocessing server locally
=========================================

There are two ways to start the PyDYNA preprocessing server

1.Start server manually
-----------------------

* Run this command in the current folder:

.. code:: console
python kwserver.py
2.Start server automatically
----------------------------

Start server on Windows
~~~~~~~~~~~~~~~~~~~~~~~

#. Set environment variable:

.. code:: bash
Variable name: ANSYS_PYDYNA_PRE_SERVER_PATH
variable value: <The file path of this package>
example of variable value: C:\pydyna\ansys-pydyna-pre-server
Start server on Linux
~~~~~~~~~~~~~~~~~~~~~

#. Set environment variable:

.. code:: bash
ANSYS_PYDYNA_PRE_SERVER_PATH=<The file path of this package>
example of variable value: /home/lstc/ansys-pydyna-pre-server
Run an example on the client side
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: bash
hostname = "localhost"
if len(sys.argv) > 1:
hostname = sys.argv[1]
solution = DynaSolution(hostname)
......
#. The function of DynaSolution() can start the preprocessing server automatically.
80 changes: 80 additions & 0 deletions doc/source/getting-started/SERVER_SOLVER_README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Start PyDYNA solver server locally
==================================

Prerequisites
-------------

Start server on Windows
~~~~~~~~~~~~~~~~~~~~~~~

#. If you want to start the server on Windows,please ensure that you have installed the ANSYS locally.

Start server on Linux(Centos7)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. If you want to start the server on Linux,please ensure that you have installed the Open MPI package.

.. code:: bash
yum install openmpi3 openmpi3-dev
#. set environment variable for Open MPI

.. code:: bash
export LD_LIBRARY_PATH=/usr/lib64/openmpi3/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi3/bin:$PATH
There are two ways to start the PyDYNA solver server
====================================================

1.Start server manually
-----------------------

* Run this command in the current folder:

.. code:: console
python server.py
2.Start Server Automatically
----------------------------

Start Server On Windows
~~~~~~~~~~~~~~~~~~~~~~~

#. Set environment variable:

.. code:: bash
Variable name: ANSYS_PYDYNA_SOLVER_SERVER_PATH
variable value: <The file path of this package>
example of variable value: C:\pydyna\ansys-pydyna-solver-server
Start Server on Linux(Centos7)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Set environment variable:

.. code:: bash
ANSYS_PYDYNA_SOLVER_SERVER_PATH=<The file path of this package>
example of variable value: /home/lstc/ansys-pydyna-solver-server
Run an example on the client side
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: bash
import ansys.dyna.core.solver as solver
hostname = "localhost"
port = "5000"
dyna=solver.DynaSolver(hostname,port) # connect to the server
dyna.push("./output/ball_plate.k") # push an input file
dyna.start_locally(input = "ball_plate.k",nproc=1)
#. The function of DynaSolver() can start the solver server automatically.
28 changes: 18 additions & 10 deletions doc/source/getting-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Both these modules are gRPC enabled and hence need to be run using server-client

Install the client
------------------
The ``ansys.dyna.core`` package supports Python 3.8 through
Python 3.11 on Windows, Linux, and MacOS.
The ``ansys.dyna.core`` package supports Python 3.9 through
Python 3.12 on Windows, Linux, and MacOS.

You should consider installing PyDYNA in a virtual environment.
For more information, see Python's
Expand Down Expand Up @@ -66,29 +66,37 @@ PyDYNA by downloading the wheelhouse archive for your corresponding machine
architecture from the `Releases Page <https://github.com/pyansys/pydyna/releases>`_.

Each wheelhouse archive contains all the Python wheels necessary to install
PyDYNA from scratch on Windows and Linux for Python 3.8 through 3.11. You can install
PyDYNA from scratch on Windows and Linux for Python 3.9 through 3.12. You can install
PyDYNA on an isolated system with a fresh Python installation or on a virtual environment.

For example, on Linux with Python 3.8, unzip the wheelhouse archive and install PyDYNA
For example, on Linux with Python 3.9, unzip the wheelhouse archive and install PyDYNA
with these commands:

.. code:: bash
unzip ansys-dyna-core-v0.3.dev0-wheelhouse-Linux-3.8.zip -d wheelhouse
unzip ansys-dyna-core-v0.3.dev0-wheelhouse-Linux-3.9.zip -d wheelhouse
pip install ansys-dyna-core -f wheelhouse --no-index --upgrade --ignore-installed
If you're on Windows with Python 3.8, unzip the wheelhouse archive to a ``wheelhouse``
If you're on Windows with Python 3.9, unzip the wheelhouse archive to a ``wheelhouse``
directory and install PyDYNA using the preceding command.

Install the server
------------------
Currently, PyDYNA server is only supported withing a Docker container.
Future releases support launching the servers directly on local machines as well.
Run PyDYNA Server locally
-------------------------
Launching the servers directly on local machines.

.. include:: ./SERVER_PRE_README.rst

.. include:: ./SERVER_SOLVER_README.rst

Run PyDYNA Server in a Docker container
---------------------------------------
PyDYNA server can be run in a Docker container.

.. include:: ../../../docker/pre/README.rst

.. include:: ../../../docker/solver/README.rst


.. LINKS
.. _pydyna_pypi: https://pypi.org/projects/ansys-dyna-core/
.. _pydyna_repo: https://github.com/ansys/pydyna/
Expand Down
2 changes: 1 addition & 1 deletion docker/pre/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pydyna-pre service Linux-based Dockerfile

FROM python:3.8-slim-buster
FROM python:3.9-slim-buster

# Define the working directory
WORKDIR /server
Expand Down
31 changes: 22 additions & 9 deletions docker/solver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ RUN yum -y install openssh-clients openssh-server bind-utils sudo python3
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install grpcio
RUN python3 -m pip install grpcio-tools
RUN python3 -m pip install protobuf==4.21.0
#
ENV USER mpirun
ENV HOME /home/mpirun
ENV LD_LIBRARY_PATH /ansys_inc/lib
ENV LSTC_LICENSE network
ENV LSTC_LICENSE_SERVER license
ENV SSHDIR ${HOME}/.ssh/
ENV SSHDIR ${HOME}/.ssh


RUN groupadd ${USER}
Expand Down Expand Up @@ -65,10 +66,18 @@ CMD ["/usr/sbin/sshd", "-D"]
ENV PATH /opt/openmpi/bin:${PATH}
RUN echo "export PATH=/opt/openmpi/bin:\${PATH}" >> ${HOME}/.bashrc

ADD ssh/config ${SSHDIR}/config
ADD ssh/id_rsa ${SSHDIR}/id_rsa
ADD ssh/id_rsa.pub ${SSHDIR}/id_rsa.pub
ADD ssh/id_rsa.pub ${SSHDIR}/authorized_keys
#ADD ssh/config ${SSHDIR}/config
#ADD ssh/id_rsa ${SSHDIR}/id_rsa
#ADD ssh/id_rsa.pub ${SSHDIR}/id_rsa.pub
#ADD ssh/id_rsa.pub ${SSHDIR}/authorized_keys
#RUN ssh-keygen -A


RUN ssh-keygen -q -b 2048 -f ${SSHDIR}/id_rsa -N ""
RUN chmod 700 ${SSHDIR} && chmod -R 600 ${SSHDIR}/id_rsa
RUN echo "Host *" > ${SSHDIR}/config
RUN echo " StrictHostKeyChecking no" >> ${SSHDIR}/config
RUN cp ${SSHDIR}/id_rsa.pub ${SSHDIR}/authorized_keys
RUN ssh-keygen -A

RUN chmod -R 600 ${SSHDIR}* && \
Expand All @@ -78,11 +87,15 @@ RUN chown -R ${USER}:${USER} ${HOME}

# Copy the openmpi libraries

RUN mkdir -p /opt
COPY mpi /opt/openmpi
RUN yum install -y unzip
COPY mppdyna_docker_centos7.zip .
RUN unzip -qu mppdyna_docker_centos7.zip && rm mppdyna_docker_centos7.zip
RUN mkdir -p /opt/openmpi
RUN cp -r mpi/* /opt/openmpi
RUN chmod -R 777 /opt/openmpi

# The executable will go in /ansys_inc, and the
# ifort runtime libraries in /ansys_inc/lib

COPY docker_dir /ansys_inc
RUN chmod 755 /ansys_inc/server.py
RUN cp -rpu docker_dir/* /ansys_inc/
RUN chmod -R 777 /ansys_inc/
Loading

0 comments on commit 2fd67a8

Please sign in to comment.