Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ cython_debug/
# Ignore rendered examples
doc/source/examples/
doc/source/API/_autosummary/
doc/source/autoapi
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

# Intersphinx mapping
intersphinx_mapping = {
"python": ("https://docs.python.org/dev", None),
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/devdocs", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"imageio": ("https://imageio.readthedocs.io/en/stable", None),
Expand All @@ -50,7 +50,7 @@
# general
"GL06", # Found unknown section
"GL07", # Sections are in the wrong order.
"GL08", # The object does not have a docstring
# "GL08", # The object does not have a docstring
"GL09", # Deprecation warning should precede extended summary
"GL10", # reST directives {directives} must be followed by two colons
# Summary
Expand Down
79 changes: 50 additions & 29 deletions doc/source/getting-started/index.rst
Original file line number Diff line number Diff line change
@@ -1,50 +1,71 @@
Getting started
===============

************
Installation
~~~~~~~~~~~~
************

This package is not yet available on the public PyPI, but you can still install
it using ``pip`` from the private PyPI repository.
Python module
~~~~~~~~~~~~~

The following on Windows:
The ``ansys.dyna.core`` package currently supports Python 3.8 through
Python 3.10 on Windows, Mac OS, and Linux.

.. code::
Install the latest release from
`PyPI <pydyna_pypi_>`_ with:

set PYANSYS_PYPI_PRIVATE_PAT=<REDACTED>
set INDEX_URL=https://%PYANSYS_PYPI_PRIVATE_PAT%@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/
python -m pip install ansys-dyna-core --index-url %INDEX_URL%
.. code:: console

And if you are running Linux:
pip install ansys-dyna-core

.. code::
Alternatively, install the latest from
`PyDyna GitHub <pydyna_issues_>`_ via:

PYANSYS_PYPI_PRIVATE_PAT=<REDACTED>
export INDEX_URL='https://$PYANSYS_PYPI_PRIVATE_PAT@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/'
python -m pip install ansys-dyna-core --index-url $INDEX_URL
.. code:: console

pip install git+https://github.com/pyansys/pydyna.git


Email your friendly PyAnsys team member for the ``PYANSYS_PYPI_PRIVATE_PAT``
at `pyansys.core@ansys.com <mailto:pyansys.core@ansys.com>`_ or send a message via Teams.
For a local *development* version, install with:

**Installing from git**
.. code:: console

If you have ``git`` installed and want the bleeding edge version:
git clone https://github.com/pyansys/pydyna.git
cd pydyna
pip install -e .

.. code::
This allows you to install the ``ansys-dyna-core`` module
and modify it locally and have the changes reflected in your setup
after restarting the Python kernel.

pip install -U git+https://github.com/pyansys/pyDyna@main
Offline installation
~~~~~~~~~~~~~~~~~~~~
If you lack an internet connection on your install machine, the recommended way
of installing PyDyna is downloading the wheelhouse archive from the
`Releases Page <pydyna_releases_>`_ for your corresponding
machine architecture.

You need to be logged into GitHub locally and be a member of the `PyAnsys Organization <https://github.com/pyansys>`_.
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
this on an isolated system with a fresh Python or on a virtual environment.

Alternatively, if you need to modify the repository locally (or want to
do local development), you can clone it and install it in "development" mode with:
For example, on Linux with Python 3.8, unzip it and install it with the following:

.. code::
.. code:: console

git clone https://github.com/pyansys/pyDyna
cd pyDyna
pip install -e .
unzip ansys-dyna-core-v0.3.1-wheelhouse-ubuntu-latest-3.8.zip wheelhouse
pip install ansys-dyna-core -f wheelhouse --no-index --upgrade --ignore-installed

If you're on Windows with Python 3.8, unzip to a ``wheelhouse`` directory and
install using the preceding command.

Consider installing using a `virtual environment <using_venv_>`_.

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

Note the ``-e`` flag, which denotes that you are in development mode.
You can make changes in the local ``pyDyna`` and have them reflected
in your local install of PyDyna.
.. LINKS
.. _pydyna_pypi: https://pypi.org/projects/ansys-dyna-core/
.. _pydyna_releases: https://github.com/ansys/pydyna/releases
.. _pydyna_issues: https://github.com/ansys/pydyna/issues
.. _using_venv: https://docs.python.org/3/library/venv.html
9 changes: 0 additions & 9 deletions doc/source/user-guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,3 @@ leaving a Python environment.

Visit the `DPF-Post Documentation <https://post.docs.pyansys.com>`_ for a
detailed description of the package

.. toctree::
:hidden:

pydyna_pre
pydyna_solver
pydyna_post


54 changes: 17 additions & 37 deletions docker/pre/README.rst
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
Create your own pydyna-pre service docker container
===================================================
Build pydyna-pre service docker container
:::::::::::::::::::::::::::::::::::::::::

The pydyna-pre service Docker containers can be easily built by following
these steps.

Inside this folder, the instructions (i.e. ``Dockerfile`` files) for
building the pydyna-pre service Docker containers are made available.
To build the docker image you will need to clone pydyna repo locally:

* ``Dockerfile``: this file builds the Linux-based Docker image.
.. code:: console

git clone https://github.com/pyansys/pydyna.git
cd pydyna

* ``docker/pre/Dockerfile``: this file builds the Linux-based Docker image.

Prerequisites
^^^^^^^^^^^^^

* Ensure that ``docker`` is installed in your machine.
If you do not have ``docker`` available, please refer to the
`official Docker site <https://www.docker.com>`_.
Note that the container can also be started on Windows if the Docker Desktop has been installed.
How to install the Docker Desktop: https://docs.docker.com/desktop/install/windows-install/

* Download the latest release artifacts. You can do this as follows:
* Download the latest release artifacts for the Linux
Docker container. You can do this as follows:

* Latest Linux artifacts: `linux-binaries.zip <https://github.com/ansys/pydyna/releases/download/v0.2.1/linux-binaries.zip>`_

* Move these ``.zip`` files to the current location (i.e. ``<repository-root-folder>/docker/pre``).

Starting the docker container
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There are two ways to start docker container.

1.bulid image and run container
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Move these ``.zip`` files to the current location (i.e. ``<repository-root-folder>/docker``).

Building the Docker images
::::::::::::::::::::::::::
^^^^^^^^^^^^^^^^^^^^^^^^^^

In order to build your images, follow the next instructions:

* Locate yourself at ``<repository-root-folder>/docker/pre`` in your terminal.
* Locate yourself at ``<repository-root-folder>/docker`` in your terminal.
* Run the following Docker command:

.. code:: bash
Expand All @@ -61,13 +56,13 @@ In order to build your images, follow the next instructions:
>>> ...... ...... ............ .............. ......

Run the image as a container
::::::::::::::::::::::::::::
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* Run the following Docker command:

.. code:: bash

docker run -d -p 50051:50051 ghcr.io/ansys/ls-pre
docker run -d -p 50051:50051 ghcr.io/ansys/ls-pre .

* Check that the image has been created successfully.

Expand All @@ -76,19 +71,4 @@ Run the image as a container


>>> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
>>> c77ffd67f9fa ghcr.io/ansys/ls-pre "python3 ./linux-bin…" 7 seconds ago Up 7 seconds 0.0.0.0:50051->50051/tcp, :::50051->50051/tcp hardcore_margulis


2.Start the container from docker-compose.yml file
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Make sure the docker compose have been installed on your computer.
For more information: https://docs.docker.com/compose/install/

* Locate yourself at ``<repository-root-folder>/docker/pre`` in your terminal.
* Run the following Docker command:

.. code:: bash

docker compose up -d

>>> c77ffd67f9fa ghcr.io/ansys/ls-pre "python3 ./linux-bin…" 7 seconds ago Up 7 seconds 0.0.0.0:50051->50051/tcp, :::50051->50051/tcp hardcore_margulis
87 changes: 87 additions & 0 deletions docker/solver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FROM centos:7
#
# The order of the lines in here should be (as much as possible) in
# an order that will create the same series of intermediate images
# no mater what version of dyna we are using. This will speed up
# experiments when creating containers over and over. Ordering the
# commands this way makes the Dockerfile a bit more confusing, because
# for example we make all the directories up top, but don't put things
# in them until further down. And some environment variables are near
# the top, but others near the bottom

LABEL "com.ansys.description"="Ansys MPPDYNA with gRPC server"

# install some missing stuff we want/need

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
#
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/


RUN groupadd ${USER}
RUN useradd -g ${USER} -d ${HOME} ${USER} && \
echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#
RUN mkdir -p /ansys_inc/lib
RUN mkdir -p /rundir
RUN mkdir /var/run/sshd
RUN mkdir -p ${SSHDIR}
RUN chown -R ${USER}:${USER} /rundir
RUN chmod -R 755 /rundir
WORKDIR /rundir

# set up the runtime environment variables for
# dyna

RUN echo "export LD_LIBRARY_PATH=/ansys_inc/lib:/opt/openmpi/lib" > ${HOME}/.bashrc
# Adding these causes problems because they can't be overridden
# via the "environment" attribute in a docker-compose file.
# The ENV commands above come through as defaults, but can be
# overridden (to use the ANSYS license, or a different license server)
#
# RUN echo "export LSTC_LICENSE=network" >> ${HOME}/.bashrc
# RUN echo "export LSTC_LICENSE_SERVER=license" >> ${HOME}/.bashrc
#
# Get ssh properly set up
#
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
#
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
#
# Everything above here should not depend on the version of DYNA or the MPI we are using
# and so should behave nicely as regards the Docker image cache. Below here not so much
#
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
RUN ssh-keygen -A

RUN chmod -R 600 ${SSHDIR}* && \
chown -R ${USER}:${USER} ${SSHDIR}

RUN chown -R ${USER}:${USER} ${HOME}

# Copy the openmpi libraries

RUN mkdir -p /opt
COPY mpi /opt/openmpi

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

COPY docker_dir /ansys_inc
67 changes: 67 additions & 0 deletions docker/solver/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Build pydyna-solver service docker container
::::::::::::::::::::::::::::::::::::::::::::

The pydyna-solver service Docker containers can be easily built by following
these steps.

* ``docker/solver/Dockerfile``: this file builds the Linux-based Docker image.

Prerequisites
^^^^^^^^^^^^^

* Ensure that ``docker`` is installed in your machine.
If you do not have ``docker`` available, please refer to the
`official Docker site <https://www.docker.com>`_.

* If you are building the image on Windows, you will need to have
Windows Subsystem for Linux (WSL) installed. The instructions for that can be found `here <https://learn.microsoft.com/en-us/windows/wsl/install>`

* Download the latest release artifacts for the Linux
Docker container. You can do this as follows:

* Latest Linux artifacts: `mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.2.1/mppdyna_docker_centos7.zip>`_

* Move these ``.zip`` files to a local directory ``local_image_build_dir``.

Building the Docker images
^^^^^^^^^^^^^^^^^^^^^^^^^^

In order to build your images, follow the next instructions:

* cd to ``local_image_build_dir``.
* Run the following Docker command:

.. code:: bash

./do_build

* Check that the image has been created successfully. You should see an output similar
to this one when running the following command:

.. code:: bash

docker images

>>> REPOSITORY TAG IMAGE ID CREATED SIZE
>>> dyna_solver_v04 latest defbadbeee8e 16 minutes ago 730MB
>>> ...... ...... ............ .............. ......

Run the image as a container
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* Edit the docker-compose.yml file and replace ``<license_server_name>`` with the correct license server hosting the DYNA license.
If you are using Ansy Flexlm license

* Run the following Docker command:

.. code:: bash

docker-compose up

* Check that the image has been created successfully.


.. code:: bash

>>> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
>>> be84c95db31d dyna_solver_v04 "/ansys_inc/server.p…" 18 minutes ago Up 8 seconds 22/tcp, 0.0.0.0:5000->5000/tcp mppdyna_docker_centos7_dyna_1
Loading