Skip to content

Commit 6263660

Browse files
kanthadyaRobPasMue
andauthored
Doc updates (#202)
Co-authored-by: Roberto Pastor Muela <[email protected]>
1 parent 4c8f68a commit 6263660

File tree

20 files changed

+327
-166
lines changed

20 files changed

+327
-166
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,4 @@ cython_debug/
164164
# Ignore rendered examples
165165
doc/source/examples/
166166
doc/source/API/_autosummary/
167+
doc/source/autoapi

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Intersphinx mapping
3535
intersphinx_mapping = {
36-
"python": ("https://docs.python.org/dev", None),
36+
"python": ("https://docs.python.org/3", None),
3737
"numpy": ("https://numpy.org/devdocs", None),
3838
"matplotlib": ("https://matplotlib.org/stable", None),
3939
"imageio": ("https://imageio.readthedocs.io/en/stable", None),
@@ -50,7 +50,7 @@
5050
# general
5151
"GL06", # Found unknown section
5252
"GL07", # Sections are in the wrong order.
53-
"GL08", # The object does not have a docstring
53+
# "GL08", # The object does not have a docstring
5454
"GL09", # Deprecation warning should precede extended summary
5555
"GL10", # reST directives {directives} must be followed by two colons
5656
# Summary
Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,71 @@
11
Getting started
22
===============
33

4+
************
45
Installation
5-
~~~~~~~~~~~~
6+
************
67

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

10-
The following on Windows:
11+
The ``ansys.dyna.core`` package currently supports Python 3.8 through
12+
Python 3.10 on Windows, Mac OS, and Linux.
1113

12-
.. code::
14+
Install the latest release from
15+
`PyPI <pydyna_pypi_>`_ with:
1316

14-
set PYANSYS_PYPI_PRIVATE_PAT=<REDACTED>
15-
set INDEX_URL=https://%PYANSYS_PYPI_PRIVATE_PAT%@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/
16-
python -m pip install ansys-dyna-core --index-url %INDEX_URL%
17+
.. code:: console
1718
18-
And if you are running Linux:
19+
pip install ansys-dyna-core
1920
20-
.. code::
21+
Alternatively, install the latest from
22+
`PyDyna GitHub <pydyna_issues_>`_ via:
2123

22-
PYANSYS_PYPI_PRIVATE_PAT=<REDACTED>
23-
export INDEX_URL='https://[email protected]/pyansys/_packaging/pyansys/pypi/simple/'
24-
python -m pip install ansys-dyna-core --index-url $INDEX_URL
24+
.. code:: console
25+
26+
pip install git+https://github.com/pyansys/pydyna.git
27+
2528
26-
Email your friendly PyAnsys team member for the ``PYANSYS_PYPI_PRIVATE_PAT``
27-
at `[email protected] <mailto:[email protected]>`_ or send a message via Teams.
29+
For a local *development* version, install with:
2830

29-
**Installing from git**
31+
.. code:: console
3032
31-
If you have ``git`` installed and want the bleeding edge version:
33+
git clone https://github.com/pyansys/pydyna.git
34+
cd pydyna
35+
pip install -e .
3236
33-
.. code::
37+
This allows you to install the ``ansys-dyna-core`` module
38+
and modify it locally and have the changes reflected in your setup
39+
after restarting the Python kernel.
3440

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

37-
You need to be logged into GitHub locally and be a member of the `PyAnsys Organization <https://github.com/pyansys>`_.
48+
Each wheelhouse archive contains all the Python wheels necessary to install
49+
PyDyna from scratch on Windows and Linux for Python 3.8 through 3.11. You can install
50+
this on an isolated system with a fresh Python or on a virtual environment.
3851

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

42-
.. code::
54+
.. code:: console
4355
44-
git clone https://github.com/pyansys/pyDyna
45-
cd pyDyna
46-
pip install -e .
56+
unzip ansys-dyna-core-v0.3.1-wheelhouse-ubuntu-latest-3.8.zip wheelhouse
57+
pip install ansys-dyna-core -f wheelhouse --no-index --upgrade --ignore-installed
58+
59+
If you're on Windows with Python 3.8, unzip to a ``wheelhouse`` directory and
60+
install using the preceding command.
61+
62+
Consider installing using a `virtual environment <using_venv_>`_.
63+
64+
.. include:: ../../../docker/pre/README.rst
65+
.. include:: ../../../docker/solver/README.rst
4766

48-
Note the ``-e`` flag, which denotes that you are in development mode.
49-
You can make changes in the local ``pyDyna`` and have them reflected
50-
in your local install of PyDyna.
67+
.. LINKS
68+
.. _pydyna_pypi: https://pypi.org/projects/ansys-dyna-core/
69+
.. _pydyna_releases: https://github.com/ansys/pydyna/releases
70+
.. _pydyna_issues: https://github.com/ansys/pydyna/issues
71+
.. _using_venv: https://docs.python.org/3/library/venv.html

doc/source/user-guide/index.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,3 @@ leaving a Python environment.
2626

2727
Visit the `DPF-Post Documentation <https://post.docs.pyansys.com>`_ for a
2828
detailed description of the package
29-
30-
.. toctree::
31-
:hidden:
32-
33-
pydyna_pre
34-
pydyna_solver
35-
pydyna_post
36-
37-

docker/pre/README.rst

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
1-
Create your own pydyna-pre service docker container
2-
===================================================
1+
Build pydyna-pre service docker container
2+
:::::::::::::::::::::::::::::::::::::::::
33

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

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

10-
* ``Dockerfile``: this file builds the Linux-based Docker image.
9+
.. code:: console
10+
11+
git clone https://github.com/pyansys/pydyna.git
12+
cd pydyna
13+
14+
* ``docker/pre/Dockerfile``: this file builds the Linux-based Docker image.
1115

1216
Prerequisites
1317
^^^^^^^^^^^^^
1418

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

21-
* Download the latest release artifacts. You can do this as follows:
23+
* Download the latest release artifacts for the Linux
24+
Docker container. You can do this as follows:
2225

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

25-
* Move these ``.zip`` files to the current location (i.e. ``<repository-root-folder>/docker/pre``).
26-
27-
Starting the docker container
28-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29-
30-
There are two ways to start docker container.
31-
32-
1.bulid image and run container
33-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
28+
* Move these ``.zip`` files to the current location (i.e. ``<repository-root-folder>/docker``).
3429

3530
Building the Docker images
36-
::::::::::::::::::::::::::
31+
^^^^^^^^^^^^^^^^^^^^^^^^^^
3732

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

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

4338
.. code:: bash
@@ -61,13 +56,13 @@ In order to build your images, follow the next instructions:
6156
>>> ...... ...... ............ .............. ......
6257
6358
Run the image as a container
64-
::::::::::::::::::::::::::::
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6560

6661
* Run the following Docker command:
6762

6863
.. code:: bash
6964
70-
docker run -d -p 50051:50051 ghcr.io/ansys/ls-pre
65+
docker run -d -p 50051:50051 ghcr.io/ansys/ls-pre .
7166
7267
* Check that the image has been created successfully.
7368

@@ -76,19 +71,4 @@ Run the image as a container
7671
7772
7873
>>> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79-
>>> 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
80-
81-
82-
2.Start the container from docker-compose.yml file
83-
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
84-
85-
Make sure the docker compose have been installed on your computer.
86-
For more information: https://docs.docker.com/compose/install/
87-
88-
* Locate yourself at ``<repository-root-folder>/docker/pre`` in your terminal.
89-
* Run the following Docker command:
90-
91-
.. code:: bash
92-
93-
docker compose up -d
94-
74+
>>> 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

docker/solver/Dockerfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
FROM centos:7
2+
#
3+
# The order of the lines in here should be (as much as possible) in
4+
# an order that will create the same series of intermediate images
5+
# no mater what version of dyna we are using. This will speed up
6+
# experiments when creating containers over and over. Ordering the
7+
# commands this way makes the Dockerfile a bit more confusing, because
8+
# for example we make all the directories up top, but don't put things
9+
# in them until further down. And some environment variables are near
10+
# the top, but others near the bottom
11+
12+
LABEL "com.ansys.description"="Ansys MPPDYNA with gRPC server"
13+
14+
# install some missing stuff we want/need
15+
16+
RUN yum -y install openssh-clients openssh-server bind-utils sudo python3
17+
RUN python3 -m pip install --upgrade pip
18+
RUN python3 -m pip install grpcio
19+
RUN python3 -m pip install grpcio-tools
20+
#
21+
ENV USER mpirun
22+
ENV HOME /home/mpirun
23+
ENV LD_LIBRARY_PATH /ansys_inc/lib
24+
ENV LSTC_LICENSE network
25+
ENV LSTC_LICENSE_SERVER license
26+
ENV SSHDIR ${HOME}/.ssh/
27+
28+
29+
RUN groupadd ${USER}
30+
RUN useradd -g ${USER} -d ${HOME} ${USER} && \
31+
echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
32+
#
33+
RUN mkdir -p /ansys_inc/lib
34+
RUN mkdir -p /rundir
35+
RUN mkdir /var/run/sshd
36+
RUN mkdir -p ${SSHDIR}
37+
RUN chown -R ${USER}:${USER} /rundir
38+
RUN chmod -R 755 /rundir
39+
WORKDIR /rundir
40+
41+
# set up the runtime environment variables for
42+
# dyna
43+
44+
RUN echo "export LD_LIBRARY_PATH=/ansys_inc/lib:/opt/openmpi/lib" > ${HOME}/.bashrc
45+
# Adding these causes problems because they can't be overridden
46+
# via the "environment" attribute in a docker-compose file.
47+
# The ENV commands above come through as defaults, but can be
48+
# overridden (to use the ANSYS license, or a different license server)
49+
#
50+
# RUN echo "export LSTC_LICENSE=network" >> ${HOME}/.bashrc
51+
# RUN echo "export LSTC_LICENSE_SERVER=license" >> ${HOME}/.bashrc
52+
#
53+
# Get ssh properly set up
54+
#
55+
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
56+
# SSH login fix. Otherwise user is kicked off after login
57+
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
58+
#
59+
EXPOSE 22
60+
CMD ["/usr/sbin/sshd", "-D"]
61+
#
62+
# Everything above here should not depend on the version of DYNA or the MPI we are using
63+
# and so should behave nicely as regards the Docker image cache. Below here not so much
64+
#
65+
ENV PATH /opt/openmpi/bin:${PATH}
66+
RUN echo "export PATH=/opt/openmpi/bin:\${PATH}" >> ${HOME}/.bashrc
67+
68+
ADD ssh/config ${SSHDIR}/config
69+
ADD ssh/id_rsa ${SSHDIR}/id_rsa
70+
ADD ssh/id_rsa.pub ${SSHDIR}/id_rsa.pub
71+
ADD ssh/id_rsa.pub ${SSHDIR}/authorized_keys
72+
RUN ssh-keygen -A
73+
74+
RUN chmod -R 600 ${SSHDIR}* && \
75+
chown -R ${USER}:${USER} ${SSHDIR}
76+
77+
RUN chown -R ${USER}:${USER} ${HOME}
78+
79+
# Copy the openmpi libraries
80+
81+
RUN mkdir -p /opt
82+
COPY mpi /opt/openmpi
83+
84+
# The executable will go in /ansys_inc, and the
85+
# ifort runtime libraries in /ansys_inc/lib
86+
87+
COPY docker_dir /ansys_inc

docker/solver/README.rst

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Build pydyna-solver service docker container
2+
::::::::::::::::::::::::::::::::::::::::::::
3+
4+
The pydyna-solver service Docker containers can be easily built by following
5+
these steps.
6+
7+
* ``docker/solver/Dockerfile``: this file builds the Linux-based Docker image.
8+
9+
Prerequisites
10+
^^^^^^^^^^^^^
11+
12+
* Ensure that ``docker`` is installed in your machine.
13+
If you do not have ``docker`` available, please refer to the
14+
`official Docker site <https://www.docker.com>`_.
15+
16+
* If you are building the image on Windows, you will need to have
17+
Windows Subsystem for Linux (WSL) installed. The instructions for that can be found `here <https://learn.microsoft.com/en-us/windows/wsl/install>`
18+
19+
* Download the latest release artifacts for the Linux
20+
Docker container. You can do this as follows:
21+
22+
* Latest Linux artifacts: `mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.2.1/mppdyna_docker_centos7.zip>`_
23+
24+
* Move these ``.zip`` files to a local directory ``local_image_build_dir``.
25+
26+
Building the Docker images
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
29+
In order to build your images, follow the next instructions:
30+
31+
* cd to ``local_image_build_dir``.
32+
* Run the following Docker command:
33+
34+
.. code:: bash
35+
36+
./do_build
37+
38+
* Check that the image has been created successfully. You should see an output similar
39+
to this one when running the following command:
40+
41+
.. code:: bash
42+
43+
docker images
44+
45+
>>> REPOSITORY TAG IMAGE ID CREATED SIZE
46+
>>> dyna_solver_v04 latest defbadbeee8e 16 minutes ago 730MB
47+
>>> ...... ...... ............ .............. ......
48+
49+
Run the image as a container
50+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51+
52+
* Edit the docker-compose.yml file and replace ``<license_server_name>`` with the correct license server hosting the DYNA license.
53+
If you are using Ansy Flexlm license
54+
55+
* Run the following Docker command:
56+
57+
.. code:: bash
58+
59+
docker-compose up
60+
61+
* Check that the image has been created successfully.
62+
63+
64+
.. code:: bash
65+
66+
>>> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
67+
>>> 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

0 commit comments

Comments
 (0)