Skip to content

Commit

Permalink
Forced int64 casting for param vector indexing to prevent windows err…
Browse files Browse the repository at this point in the history
…ors on compiled fuctions
  • Loading branch information
rlav440 committed Oct 10, 2024
1 parent cc6556e commit 7e27302
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyCamSet/optimisation/abstract_function_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def t(l):
needed_import.append("\n")

#INITIALISE THE FUNCTION
start = ["from numba import prange",
start = ["from numba import prange, int64",
"from datetime import datetime",
"from pyCamSet.optimisation.abstract_function_blocks import make_param_struct",
" ",
Expand All @@ -360,7 +360,7 @@ def t(l):
f"\t\tmemory = np.empty(wrk_mem)",
f"\t\tdense_param_arr = np.empty(param_len)",
# f"\t\tparams = np.empty(param_len)",
f"\t\tlocal_params = inp_params[block_param_inds[i].flatten()].reshape((n_lines, param_len))",
f"\t\tlocal_params = inp_params[block_param_inds[i].flatten()].reshape((int64(n_lines), int64(param_len)))",
f"\t\tfor ii in range(n_lines):",
f"\t\t\tdatum = d_data[i, ii]",
]
Expand Down Expand Up @@ -535,7 +535,7 @@ def t(l):
out_sizes.append(elem_outsize)
block_slices = np.cumsum(out_sizes) #this is actually quite a large array, but still kind of small

start = ["from numba import prange",
start = ["from numba import prange, int64",
"from numba.types import int_",
"import scipy",
"from datetime import datetime",
Expand Down Expand Up @@ -565,7 +565,7 @@ def t(l):
f"\t\tinp = np.empty(inp_mem)",
f"\t\tmemory = np.empty(wrk_mem)",
f"\t\tdense_param_arr = np.empty(param_len)",
f"\t\tlocal_params = inp_params[block_param_inds[i].flatten()].reshape((n_lines, param_len))",
f"\t\tlocal_params = inp_params[block_param_inds[i].flatten()].reshape((int64(n_lines), int64(param_len)))",
f"\t\toutput_block = np.empty({block_slices[-1]})",
f"\t\tfun_output = np.empty(np.max(n_outs))",
f"\t\tfor ii in range(n_lines):",
Expand Down

0 comments on commit 7e27302

Please sign in to comment.