diff --git a/lyceanem/electromagnetics/empropagation.py b/lyceanem/electromagnetics/empropagation.py index 2c88538..b934a4d 100644 --- a/lyceanem/electromagnetics/empropagation.py +++ b/lyceanem/electromagnetics/empropagation.py @@ -2225,6 +2225,9 @@ def EMGPUFreqDomain( # print("Number of Chunks",np.ceil(memory_requirements/max_mem).astype(int)+1) # create chunks based upon number of chunks required num_chunks = np.ceil(memory_requirements / max_mem).astype(int) + 1 + if num_chunks<0: + print(num_chunks) + source_chunking = np.linspace(0, source_num, num_chunks + 1).astype(np.int32) scattering_network = np.zeros( (source_num, sink_num, 3, 2), diff --git a/lyceanem/raycasting/rayfunctions.py b/lyceanem/raycasting/rayfunctions.py index a5e6156..5a78a84 100644 --- a/lyceanem/raycasting/rayfunctions.py +++ b/lyceanem/raycasting/rayfunctions.py @@ -2138,14 +2138,11 @@ def chunkingRaycaster1Dv3( sources, sinks, scattering_points, filtered_index, environment_local, terminate_flag ): start = timer() + cuda.current_context().memory_manager.deallocations.clear() + free_mem, total_mem = cuda.current_context().get_memory_info() max_mem = np.ceil(free_mem * 0.5).astype(np.int64) - ray_limit = ( - np.floor( - np.floor((max_mem - environment_local.nbytes) / base_types.ray_t.size) / 1e7 - ) - * 1e7 - ).astype(np.int64) + ray_limit = np.floor(((max_mem - environment_local.nbytes) / base_types.ray_t.size)).astype(np.int64) sink_index = np.arange( sources.shape[0] + 1, sources.shape[0] + 1 + sinks.shape[0] ).reshape(sinks.shape[0], 1)