Skip to content

Commit

Permalink
Add explicit imports of mpi4py, petsc4py and slepc4py submodules in s…
Browse files Browse the repository at this point in the history
…ources, tests and tutorials
  • Loading branch information
francesco-ballarin committed Mar 10, 2022
1 parent 3526fb1 commit 475f1cb
Show file tree
Hide file tree
Showing 59 changed files with 84 additions and 88 deletions.
4 changes: 2 additions & 2 deletions rbnicsx/_backends/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import os
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx.io import on_rank_zero

Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import abc
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

Function = typing.TypeVar("Function")

Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import os
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx.io import on_rank_zero

Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/online_tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import types
import typing

import mpi4py
import mpi4py.MPI
import numpy as np
import petsc4py
import petsc4py.PETSc


def create_online_vector(N: int) -> petsc4py.PETSc.Vec:
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/_backends/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import typing

import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.functions_list import FunctionsList
from rbnicsx._backends.online_tensors import BlockMatSubMatrixWrapper, BlockVecSubVectorWrapper
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/proper_orthogonal_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import typing

import numpy as np
import petsc4py
import slepc4py
import petsc4py.PETSc
import slepc4py.SLEPc

from rbnicsx._backends.functions_list import Function, FunctionsList
from rbnicsx._backends.online_tensors import create_online_matrix, create_online_vector
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/tensors_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import os
import typing

import mpi4py
import mpi4py.MPI
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx.io import on_rank_zero

Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/_backends/tensors_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import os
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx.io import on_rank_zero

Expand Down
7 changes: 1 addition & 6 deletions rbnicsx/_cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import os

import mpi4py
import mpi4py.MPI

from rbnicsx._cpp.compile_code import compile_code
from rbnicsx._cpp.compile_package import compile_package
Expand All @@ -32,8 +32,3 @@
os.path.dirname(os.path.abspath(__file__)),
*sources
)

# Clean up imports
del mpi4py

del os
1 change: 1 addition & 0 deletions rbnicsx/_cpp/compile_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import cppimport
import mpi4py
import mpi4py.MPI
import numpy
import petsc4py
import pybind11
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/_cpp/compile_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import types
import typing

import mpi4py
import mpi4py.MPI

from rbnicsx._cpp.compile_code import compile_code

Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import dolfinx.fem
import dolfinx.io
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.export import (
export_matrices as export_matrices_super, export_matrix as export_matrix_super,
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dolfinx.fem
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.functions_list import FunctionsList as FunctionsListBase
from rbnicsx.backends.export import export_functions
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/gram_schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dolfinx.fem
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx.backends.functions_list import FunctionsList

Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/backends/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import typing

import dolfinx.fem
import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx._backends.import_ import (
import_matrices as import_matrices_super, import_matrix as import_matrix_super,
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/mesh_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import dolfinx.fem
import dolfinx.mesh
import numpy as np
import petsc4py
import petsc4py.PETSc


class MeshMotion(object):
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/backends/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import typing

import dolfinx.fem
import mpi4py
import mpi4py.MPI
import numpy as np
import petsc4py
import petsc4py.PETSc
import ufl

from rbnicsx._backends.online_tensors import (
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/proper_orthogonal_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import dolfinx.fem
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.proper_orthogonal_decomposition import (
proper_orthogonal_decomposition_functions as proper_orthogonal_decomposition_functions_super,
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/symbolic_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dolfinx.mesh
import numpy as np
import petsc4py
import petsc4py.PETSc
import ufl4rom.utils


Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/tensors_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import typing

import dolfinx.fem
import mpi4py
import mpi4py.MPI
import numpy as np

from rbnicsx._backends.tensors_array import TensorsArray as TensorsArrayBase
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/backends/tensors_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from __future__ import annotations

import dolfinx.fem
import mpi4py
import mpi4py.MPI

from rbnicsx._backends.tensors_list import TensorsList as TensorsListBase
from rbnicsx.backends.export import export_matrices, export_vectors
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/io/on_rank_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import sys
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc


def on_rank_zero(
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/io/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import types
import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc


class Timer(object):
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/online/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx._backends.export import (
export_matrices as export_matrices_super, export_matrix as export_matrix_super,
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/online/functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx._backends.functions_list import FunctionsList as FunctionsListBase
from rbnicsx._backends.online_tensors import create_online_vector as create_vector
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/online/gram_schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import typing

import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx.online.functions_list import FunctionsList
from rbnicsx.online.projection import matrix_action
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/online/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import typing

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

from rbnicsx._backends.import_ import (
import_matrices as import_matrices_super, import_matrix as import_matrix_super,
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/online/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import typing

import multipledispatch
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.online_tensors import (
BlockMatSubMatrixCopier, BlockVecSubVectorCopier, create_online_matrix as create_matrix,
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/online/proper_orthogonal_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import typing

import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.proper_orthogonal_decomposition import (
proper_orthogonal_decomposition_functions as proper_orthogonal_decomposition_functions_super,
Expand Down
4 changes: 2 additions & 2 deletions rbnicsx/online/tensors_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import typing

import mpi4py
import mpi4py.MPI
import numpy as np
import petsc4py
import petsc4py.PETSc

from rbnicsx._backends.online_tensors import create_online_vector as create_vector
from rbnicsx._backends.tensors_array import TensorsArray as TensorsArrayBase
Expand Down
2 changes: 1 addition & 1 deletion rbnicsx/online/tensors_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import typing

import mpi4py
import mpi4py.MPI

from rbnicsx._backends.tensors_list import TensorsList as TensorsListBase
from rbnicsx.online.export import export_matrices, export_matrices_block, export_vectors, export_vectors_block
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/_cpp/_backends/test_frobenius_inner_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for Frobenius inner product implementation in C++."""

import mpi4py
import petsc4py
import mpi4py.MPI
import petsc4py.PETSc

import rbnicsx._cpp

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/_cpp/test_compile_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import os

import mpi4py
import mpi4py.MPI
import nbvalx.tempfile
import pytest

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/backends/test_backends_export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import dolfinx.fem
import dolfinx.mesh
import mpi4py
import mpi4py.MPI
import nbvalx.tempfile
import numpy as np
import petsc4py
import petsc4py.PETSc
import pytest
import ufl

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backends/test_backends_functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import dolfinx.fem
import dolfinx.mesh
import mpi4py
import mpi4py.MPI
import nbvalx.tempfile
import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backends/test_backends_gram_schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dolfinx.fem
import dolfinx.mesh
import mpi4py
import mpi4py.MPI
import numpy as np
import pytest
import ufl
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backends/test_backends_mesh_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import _pytest.fixtures
import dolfinx.fem
import dolfinx.mesh
import mpi4py
import mpi4py.MPI
import numpy as np
import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backends/test_backends_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dolfinx.fem
import dolfinx.mesh
import mpi4py
import mpi4py.MPI
import numpy as np
import pytest
import ufl
Expand Down
Loading

0 comments on commit 475f1cb

Please sign in to comment.