Skip to content

Commit

Permalink
Release commit created with Cranko.
Browse files Browse the repository at this point in the history
+++ cranko-release-info-v1
[[projects]]
qnames = ["toasty", "pypa"]
version = "0.19.1"
age = 0

+++
  • Loading branch information
cranko committed Jul 21, 2024
2 parents 35ef3ee + adba318 commit 0b60870
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 36 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# toasty 0.19.1 (2024-07-21)

- Update for Numpy 2.0 compatibility (#102, @pkgw). Previous releases will
work in most cases, but are not 100% compatible.
- If guessing parallelism in a Slurm HPC execution environment, try to respect
the job's resource allocation (#101, @pkgw). Often, on an HPC cluster the
number of CPU cores on the host machine will be a bad indicator of the
parallelism level that you should target, because you may only be allocated a
small fraction of them.


# toasty 0.19.0 (2023-12-14)

- Implement a `--tiling-method` argument for `toasty view` (#97, @pkgw). This
Expand Down
4 changes: 2 additions & 2 deletions ci/azure-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ parameters:
PYTHON_SERIES: "3.9"

- name: macos_310
vmImage: macos-11
vmImage: macos-12
vars:
PYTHON_SERIES: "3.10"

- name: macos_39
vmImage: macos-11
vmImage: macos-12
vars:
PYTHON_SERIES: "3.9"

Expand Down
12 changes: 6 additions & 6 deletions ci/zenodo.json5
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
],
"language": "eng",
"license": "MIT",
"publication_date": "2023-12-14",
"title": "toasty 0.19.0",
"publication_date": "2024-07-21",
"title": "toasty 0.19.1",
"upload_type": "software",
"version": "0.19.0"
"version": "0.19.1"
},
"conceptdoi": "10.5281/zenodo.7055476",
"record_id": "10383112",
"doi": "10.5281/zenodo.10383112",
"bucket_link": "https://zenodo.org/api/files/0f1838fd-9749-4f07-a18c-79180e5ffd9f"
"record_id": "12790601",
"doi": "10.5281/zenodo.12790601",
"bucket_link": "https://zenodo.org/api/files/0dce2679-0986-4ff3-b5c3-552445129113"
}
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
author = "Chris Beaumont and the AAS WorldWide Telescope Team"
copyright = "2014-2020, " + author

release = "0.19.0" # cranko project-version
release = "0.19.1" # cranko project-version
version = ".".join(release.split(".")[:2])

extensions = [
Expand Down
12 changes: 2 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
[build-system]
requires = [
'cython',
'oldest-supported-numpy',
'setuptools',
'wheel',
]
requires = ['cython', 'numpy', 'setuptools', 'wheel']
build-backend = 'setuptools.build_meta'

[tool.cranko]
annotated_files = [
"docs/conf.py",
"toasty/cli.py",
]
annotated_files = ["docs/conf.py", "toasty/cli.py"]
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_long_desc():

setup_args = dict(
name="toasty", # cranko project-name
version="0.19.0", # cranko project-version
version="0.19.1", # cranko project-version
description="Generate image tile pyramids from existing image data",
long_description=get_long_desc(),
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -94,7 +94,11 @@ def get_long_desc():
"build_ext": build_ext,
},
ext_modules=[
Extension("toasty._libtoasty", ["toasty/_libtoasty.pyx"]),
Extension(
"toasty._libtoasty",
["toasty/_libtoasty.pyx"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
),
],
include_dirs=[
np.get_include(),
Expand Down
4 changes: 3 additions & 1 deletion toasty/_libtoasty.pyx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from libc.math cimport sin, cos, atan2, hypot
import numpy as np

cimport cython

cimport numpy as np
import numpy as np

np.import_array()

DTYPE = np.float64
ctypedef np.float64_t DTYPE_t
Expand Down
4 changes: 2 additions & 2 deletions toasty/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ def show_impl(settings):
print(doi)
elif settings.show_command == "version":
# This string constant will be rewritten by Cranko during releases:
version = "0.19.0" # cranko project-version
version = "0.19.1" # cranko project-version
print(version)
elif settings.show_command == "version-doi":
# This string constant will be rewritten by Cranko during releases:
doi = "10.5281/zenodo.10383112"
doi = "10.5281/zenodo.12790601"
if not doi.startswith("10."):
warn("this DOI is a fake value used for development builds")
print(doi)
Expand Down
44 changes: 33 additions & 11 deletions toasty/par_util.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright 2020 the AAS WorldWide Telescope project
# Copyright 2020-2024 the WorldWide Telescope project
# Licensed under the MIT License.

"""Utilities for parallel processing
"""
from __future__ import absolute_import, division, print_function

__all__ = '''
__all__ = """
SHOW_INFORMATIONAL_MESSAGES
resolve_parallelism
'''.split()
""".split()

import multiprocessing as mp
import os
import sys

SHOW_INFORMATIONAL_MESSAGES = True


def resolve_parallelism(parallel):
"""Decide what level of parallelism to use.
Expand All @@ -32,17 +32,39 @@ def resolve_parallelism(parallel):
"""
if parallel is None:
if mp.get_start_method() == 'fork':
parallel = os.cpu_count()
if mp.get_start_method() == "fork":
parallel = None

# If we seem to be an HPC job, try to guess the number of CPUs based
# on the job allocation of CPUs/cores, which might be much lower
# than the number of CPUs on the system. Slurm sets many variables
# related to this stuff; I *think* the one we're using here is the
# most appropriate?

slurm_alloc = os.environ.get("SLURM_NPROCS")
if slurm_alloc:
try:
parallel = int(slurm_alloc)
except ValueError:
pass

# If we're still not sure, go with the system CPU count

if parallel is None:
parallel = os.cpu_count()

if SHOW_INFORMATIONAL_MESSAGES and parallel > 1:
print(f'info: parallelizing processing over {parallel} CPUs')
print(f"info: parallelizing processing over {parallel} CPUs")
else:
parallel = 1

if parallel > 1 and mp.get_start_method() != 'fork':
print('''warning: parallel processing was requested but is not possible
because this operating system is not using `fork`-based multiprocessing
On macOS a bug prevents forking: https://bugs.python.org/issue33725''', file=sys.stderr)
if parallel > 1 and mp.get_start_method() != "fork":
print(
"""warning: parallel processing was requested but is not possible
because this operating system is not using `fork`-based multiprocessing.
On macOS a bug prevents forking: https://bugs.python.org/issue33725""",
file=sys.stderr,
)
parallel = 1

if parallel > 1:
Expand Down
3 changes: 2 additions & 1 deletion toasty/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def healpix_fits_file_sampler(
# needed.
data = data[data.dtype.names[0]]
if data.dtype.byteorder not in "=|":
data = data.byteswap().newbyteorder()
data = data.byteswap()
data = data.view(data.dtype.newbyteorder())

nest = hdr.get("ORDERING") == "NESTED"
coord = hdr.get("COORDSYS", "C")
Expand Down

0 comments on commit 0b60870

Please sign in to comment.