Skip to content

WIP patchghostless #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
container: ghcr.io/pharchive/phare_dep/ubuntu:22.04
container: ghcr.io/pharchive/phare_dep/ubuntu:24.04
permissions:
actions: read
contents: read
Expand All @@ -35,7 +35,7 @@ jobs:

- name: Configure (cpp)
if: ${{ matrix.language == 'cpp' }}
run: mkdir build; cd build; cmake .. -Dphare_configurator=ON
run: . /.venv/bin/activate; mkdir build; cd build; cmake .. -Dphare_configurator=ON

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -50,7 +50,7 @@ jobs:

- name: Build cpp
if: ${{ matrix.language == 'cpp' }}
run: cd build; make
run: . /.venv/bin/activate; cd build; make

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
2 changes: 1 addition & 1 deletion pyphare/pyphare/cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def cpp_lib(override=None):
return importlib.import_module("pybindlibs.cpp")
try:
return importlib.import_module("pybindlibs.cpp_dbg")
except ImportError:
except (ImportError, ModuleNotFoundError):
return importlib.import_module("pybindlibs.cpp")


Expand Down
10 changes: 7 additions & 3 deletions pyphare/pyphare/pharesee/hierarchy/hierarchy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def _compute_scalardiv(patch_datas, **kwargs):

@dataclass
class EqualityReport:
atol: float
failed: List[Tuple[str, Any, Any]] = field(default_factory=lambda: [])

def __bool__(self):
Expand All @@ -602,10 +603,13 @@ def __repr__(self):
print(msg)
try:
if type(ref) is FieldData:
phut.assert_fp_any_all_close(ref[:], cmp[:], atol=1e-16)
phut.assert_fp_any_all_close(
ref[ref.box], cmp[cmp.box], atol=self.atol
)
except AssertionError as e:
print(e)
return self.failed[0][0]

return self.failed[0][0] if self.failed else "=="

def __call__(self, reason, ref=None, cmp=None):
self.failed.append((reason, ref, cmp))
Expand All @@ -622,7 +626,7 @@ def __reversed__(self):


def hierarchy_compare(this, that, atol=1e-16):
eqr = EqualityReport()
eqr = EqualityReport(atol)

if not isinstance(this, PatchHierarchy) or not isinstance(that, PatchHierarchy):
return eqr("class type mismatch")
Expand Down
2 changes: 1 addition & 1 deletion pyphare/pyphare/pharesee/hierarchy/patchdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __repr__(self):

def compare(self, that, atol=1e-16):
return self.field_name == that.field_name and phut.fp_any_all_close(
self.dataset[:], that.dataset[:], atol=atol
self[self.box], that[that.box], atol=atol
)

def __eq__(self, that):
Expand Down
3 changes: 2 additions & 1 deletion pyphare/pyphare/pharesee/particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,13 @@ def all_assert_sorted(part1, part2):
)

np.testing.assert_array_equal(part1.iCells[idx1], part2.iCells[idx2])
np.testing.assert_allclose(part1.deltas[idx1], part2.deltas[idx2], atol=deltol)

np.testing.assert_allclose(part1.v[idx1, 0], part2.v[idx2, 0], atol=1e-12)
np.testing.assert_allclose(part1.v[idx1, 1], part2.v[idx2, 1], atol=1e-12)
np.testing.assert_allclose(part1.v[idx1, 2], part2.v[idx2, 2], atol=1e-12)

np.testing.assert_allclose(part1.deltas[idx1], part2.deltas[idx2], atol=deltol)


def any_assert(part1, part2):
np.testing.assert_equal(part1.size(), part2.size())
Expand Down
12 changes: 11 additions & 1 deletion pyphare/pyphare/pharesee/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,19 @@ def all_times(self):
time = np.zeros(len(time_keys))
for it, t in enumerate(time_keys):
time[it] = float(t)
ts[quantities_per_file[basename]] = time
if basename in quantities_per_file:
ts[quantities_per_file[basename]] = time
ff.close()
return ts

def all_pops(self):
pops = set()
for file in self.available_diags:
basename = os.path.basename(file).split(".")[0]
if basename.startswith("ions_pop_"):
if any([basename.endswith(k) for k in ["density", "flux", "domain"]]):
pops.add(basename[9:].split("_")[0])
return list(pops)

def times(self, qty):
return self.all_times()[qty]
6 changes: 3 additions & 3 deletions res/cmake/def.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
endfunction(add_phare_test)

function(add_python3_test name file directory)
add_test(NAME py3_${name} COMMAND mpirun -n ${PHARE_MPI_PROCS} ${PHARE_MPIRUN_POSTFIX} python3 -u ${file} WORKING_DIRECTORY ${directory})
add_test(NAME py3_${name} COMMAND mpirun -n ${PHARE_MPI_PROCS} ${PHARE_MPIRUN_POSTFIX} ${Python_EXECUTABLE} -u ${file} WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${name})
endfunction(add_python3_test)

function(add_mpi_python3_test N name file directory)
add_test(NAME py3_${name}_mpi_n_${N} COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} python3 ${file} WORKING_DIRECTORY ${directory})
add_test(NAME py3_${name}_mpi_n_${N} COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} ${Python_EXECUTABLE} ${file} WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${name}_mpi_n_${N})
endfunction(add_mpi_python3_test)

Expand Down Expand Up @@ -273,7 +273,7 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
else()
add_test(
NAME py3_${target}_mpi_n_${N}
COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} python3 -u ${file} ${CLI_ARGS}
COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} ${Python_EXECUTABLE} -u ${file} ${CLI_ARGS}
WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${target}_mpi_n_${N})
endif()
Expand Down
9 changes: 2 additions & 7 deletions res/cmake/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
add_subdirectory(tests/initializer)


add_subdirectory(tests/amr/data/field)
add_subdirectory(tests/amr/data/particles)
add_subdirectory(tests/amr/data/field/coarsening)
add_subdirectory(tests/amr/data/field/copy_pack)
add_subdirectory(tests/amr/data/field/geometry)
add_subdirectory(tests/amr/data/field/overlap)
add_subdirectory(tests/amr/data/field/refine)
add_subdirectory(tests/amr/data/field/variable)
add_subdirectory(tests/amr/data/field/time_interpolate)

add_subdirectory(tests/amr/resources_manager)
add_subdirectory(tests/amr/messengers)
add_subdirectory(tests/amr/models)
Expand Down
Loading