Skip to content

Commit

Permalink
introduce cached_properties in GPU methods classes (no more lengthy c…
Browse files Browse the repository at this point in the history
…onstructors + bonuses from lazy evaluation + implies dropping support for Python 3.7) + some C code syntax fixes & cleanups + atomicAdd workaround for double type on older CUDA (#1141)
  • Loading branch information
slayoo authored Sep 16, 2023
1 parent bf6ceb3 commit 587163a
Show file tree
Hide file tree
Showing 18 changed files with 445 additions and 307 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/tests+artifacts+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-12, windows-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.8", "3.10"]
test-suite: ["unit_tests", "smoke_tests/box", "smoke_tests/parcel", "smoke_tests/kinematic_1d", "smoke_tests/kinematic_2d"]
exclude:
- test-suite: "devops_tests"
python-version: "3.7"
python-version: "3.8"
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
Expand All @@ -149,9 +149,6 @@ jobs:
- run: |
python -We -c "import PySDM"
- if: startsWith(matrix.platform, 'macos-') && matrix.python-version == '3.7'
run: echo SYSTEM_VERSION_COMPAT=0 >> $GITHUB_ENV

- run: |
pip install -e ./examples
pip install -e .[tests]
Expand Down Expand Up @@ -192,8 +189,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: |
python -m pip install --upgrade --user pip
- if: startsWith(matrix.platform, 'macos-') && matrix.python-version == '3.7'
run: echo SYSTEM_VERSION_COMPAT=0 >> $GITHUB_ENV
- run: |
python -m pip install -e . ./examples
python -m pip install -r tests/devops_tests/requirements.txt
Expand Down
7 changes: 4 additions & 3 deletions PySDM/backends/impl_numba/methods/collisions_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def __init__(self): # pylint: disable=too-many-statements,too-many-locals
BackendMethods.__init__(self)

_break_up = break_up_while if self.formulae.handle_all_breakups else break_up
const = self.formulae.constants

@numba.njit(**{**conf.JIT_FLAGS, "fastmath": self.formulae.fastmath})
def __collision_coalescence_breakup_body(
Expand Down Expand Up @@ -431,7 +432,7 @@ def __straub_fragmentation_body(
else:
frag_size[i] = d34[i]

frag_size[i] = frag_size[i] ** 3 * 3.1415 / 6
frag_size[i] = frag_size[i] ** 3 * const.PI / 6

self.__straub_fragmentation_body = __straub_fragmentation_body
elif self.formulae.fragmentation_function.__name__ == "LowList1982Nf":
Expand All @@ -452,7 +453,7 @@ def __ll82_fragmentation_body(
len(frag_size)
):
if dl[i] <= 0.4e-3:
frag_size[i] = dcoal[i] ** 3 * 3.1415 / 6
frag_size[i] = dcoal[i] ** 3 * const.PI / 6
elif ds[i] == 0.0 or dl[i] == 0.0:
frag_size[i] = 1e-18
else:
Expand Down Expand Up @@ -525,7 +526,7 @@ def __ll82_fragmentation_body(
frag_size[i] = (
frag_size[i] * 0.01
) # diameter in cm; convert to m
frag_size[i] = frag_size[i] ** 3 * 3.1415 / 6
frag_size[i] = frag_size[i] ** 3 * const.PI / 6

self.__ll82_fragmentation_body = __ll82_fragmentation_body
elif self.formulae.fragmentation_function.__name__ == "Gaussian":
Expand Down
Loading

0 comments on commit 587163a

Please sign in to comment.