Skip to content
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

Fix 4GB part size limit in hori_buffer_len #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 horayzon/horizon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ def horizon_gridded(
# Allocate horizon array
cdef float hori_buffer_size = (vec_norm.shape[0] * vec_norm.shape[1] *
azim_num * 4) / (10.0 ** 9.0)
cdef int hori_buffer_len
cdef np.int64_t hori_buffer_len
if hori_buffer_size <= hori_buffer_size_max:
print("Horizon buffer size is below specified limit")
hori_buffer_len = vec_norm.shape[0] * vec_norm.shape[1] * azim_num
else:
print("Horizon buffer size is restricted")
hori_buffer_len = int((hori_buffer_size_max * 10 ** 9) / 4) + 100000
hori_buffer_len = np.int64((hori_buffer_size_max * 10 ** 9) / 4) + 100000
# add some "safety" memory to the buffer (-> 100000)
cdef np.ndarray[np.float32_t, ndim = 1, mode = "c"] \
hori_buffer = np.empty(hori_buffer_len, dtype=np.float32)
Expand Down Expand Up @@ -378,7 +378,7 @@ def horizon_locations(
units_c = units.encode("utf-8")

# Allocate horizon array
cdef int hori_buffer_len = vec_norm.shape[0] * azim_num
cdef np.int64_t hori_buffer_len = vec_norm.shape[0] * azim_num
cdef np.ndarray[np.float32_t, ndim = 1, mode = "c"] \
hori_buffer = np.empty(hori_buffer_len, dtype=np.float32)
hori_buffer.fill(np.nan)
Expand Down