Skip to content

Latest commit

 

History

History
151 lines (117 loc) · 4.59 KB

compiling.md

File metadata and controls

151 lines (117 loc) · 4.59 KB

Compiling

  1. Clone the package repository:

    git clone https://github.com/claudioperez/OpenSeesRT
  2. install run-time dependencies. These are the libraries that will be needed in order to use OpenSees. To install these, run:

    python -m pip install opensees
  3. Install compile-time dependencies; see Dependencies below. These dependencies are only needed for the compilinf process.

  4. Create a persistent build tree for C/C++ development:

    1. Run the CMake configure operation. This should be carried out by running the following command:

      python setup.py cmake

      This effectively runs the standard CMake configure procedure (i.e., mkdir build && cd build && cmake ..) but adds flags to ensure the proper libraries and compilers are found. The name of the resulting build directory will depend on factors such as your operating system, and the version of Python that is installed in the environment. An example might be ./build/temp.linux-x86_64-cpython-39_local/, where . refers to the directory that contains setup.py.

    2. Navigate into the build tree that was generated by the last step, and build the OpenSeesRT target to create libOpenSeesRT.so. Building is typically performed by executing one of:

      cmake --build . --target OpenSeesRT -j8
      # or if using make
      make OpenSeesRT -j8

      where the option -j8 makes the build faster and can be adjusted for your needs and resources (see make documentation).

    3. When libOpenSeesRT.so is built in a persistent tree, the opensees package needs to be told where to find it. This can be done by setting an environment variable with the name OPENSEESRT_LIB to point to the location of libOpenSeesRT.so in the build tree. To this end, you may want to add a line llike the following to your shell startup script (e.g., .bashrc):

      export OPENSEESRT_LIB="/path/to/your/compiled/libOpenSeesRT.so"
  5. Check that everything was built properly by running the following command:

    python -m opensees

    This should start an OpenSees interpreter which can be closed by running the exit command.

Dependencies

The primary system dependencies required for compiling are LAPACK/BLAS and Tcl. Packages providing these libraries are listed below for various package management ecosystems.

IMPORTANT When building in an Anaconda environment, you should install all dependencies with conda or mamba, and preferably from the conda-forge channel. Expand the notes on Anaconda below.

Windows: Install Intel compilers and Conan

APT (Ubuntu, Debian Linux)
Dependency Package
LAPACK liblapack-dev
BLAS libblas-dev
Tcl* tcl-dev
Pacman (Arch, Manjaro Linux)

The Pacman package manager

Dependency Package
LAPACK lapack
BLAS blas
Tcl* tcl
Anaconda (Mac, Windows, Linux)

When using conda, you need to ensure that CMake only finds compilers that are compatible with the libraries in the environment. System compilers (like those installed by the operating system's package manager) often cannot be used and can lead to segfaults. The following command should install everything you need:

conda install -c conda-forge fortran-compiler cxx-compiler c-compiler openblas
Yum (CentOS, Redhat Linux)
Dependency Package
LAPACK lapack-devel
Tcl* tcl-devel

Other

  • Windows CI build

    python scripts\win_repair.py win32 wheelhouse\opensees-*

Build Variations

The build type can be configured through the file setup.py. For example, to change from a Release to Debug build, look for the following lines in setup.py and make the appropriate change:

                cmake_configure_options = [
                    "-G", "Unix Makefiles",
                    *EnvArgs,
                    "-DCMAKE_BUILD_TYPE=DEBUG",
#                   "-DCMAKE_BUILD_TYPE=RELEASE",

After this is changed, step 5 needs to be performed again.