Closed sannant closed 5 years ago
Did you encounter a problem somewhere? We should only implement things that we actually need somewhere.
Yes see CI tests:
tests/test_LBFGS_interface.py ........... [ 15%]
tests/test_LBFGS_minimization_problems.py .... [ 21%]
tests/test_MPI_LBFGS.py .......s [ 32%]
tests/test_ParallelNumpy.py ................ [ 54%]
tests/test_io.py xFFFFFFFxFx [ 70%]
tests/test_minimization_problems.py .............. [ 90%]
tests/test_simple_LBFGS.py ....... [100%]
=================================== FAILURES ===================================
_______________________ test_FileSave_2D[make_2d_slab_x] _______________________
decompfun = <function make_2d_slab_x at 0x7f8c915227b8>
comm = <NuMPI.MPIStub.Communicator object at 0x7f8c9d5da278>
globaldata = array([[0.4359949 , 0.02592623, 0.54966248, ..., 0.27405925, 0.01025004,
0.62935972],
[0.29517231, 0.18...23,
0.79000339],
[0.41333251, 0.63899521, 0.95422417, ..., 0.52988765, 0.09137043,
0.52526125]])
@pytest.mark.parametrize("decompfun",[make_2d_slab_x, make_2d_slab_y])
def test_FileSave_2D(decompfun, comm, globaldata):
distdata = decompfun(comm, globaldata)
save_npy("test_Filesave_2D.npy",
distdata.data,
distdata.subdomain_location,
> distdata.domain_resolution, comm)
tests/test_io.py:159:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fn = 'test_Filesave_2D.npy'
data = array([[0.4359949 , 0.02592623, 0.54966248, ..., 0.27405925, 0.01025004,
0.62935972],
[0.29517231, 0.18...23,
0.79000339],
[0.41333251, 0.63899521, 0.95422417, ..., 0.52988765, 0.09137043,
0.52526125]])
subdomain_location = [0, 0], resolution = (128, 128)
comm = <NuMPI.MPIStub.Communicator object at 0x7f8c9d5da278>
def save_npy(fn, data, subdomain_location=None, resolution=None, comm=MPI.COMM_WORLD):
"""
Parameters
----------
data : numpy array : data owned by the processor
location : index of the first element of data within the global data
resolution : resolution of the global data
comm : MPI communicator
Returns
-------
"""
if len(data.shape) != 2: raise ValueError
subdomain_resolution = data.shape
if subdomain_location is None:
subdomain_location = (0,0)
if resolution is None:
resolution = subdomain_resolution
from numpy.lib.format import dtype_to_descr, magic
magic_str = magic(1, 0)
arr_dict_str = str({'descr': dtype_to_descr(data.dtype),
'fortran_order': False,
'shape': resolution})
while (len(arr_dict_str) + len(magic_str) + 2) % 16 != 15:
arr_dict_str += ' '
arr_dict_str += '\n'
header_len = len(arr_dict_str) + len(magic_str) + 2
> file = MPI.File.Open(comm, fn, MPI.MODE_CREATE | MPI.MODE_WRONLY)
E TypeError: unsupported operand type(s) for |: 'OpeningModes' and 'OpeningModes'
Here a comparison in the behaviour of
Combining the modes with the
|
- Operator is part of MPI3 Standart.I guess we should make an operator overloading that maps the bitwise or to the concatenation of strings. See