Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jinluchang committed Jun 9, 2024
1 parent 635a247 commit ded2c59
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions qlat-utils/qlat_utils/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
'displayln_malloc_stats',
#
'get_all_caches_info',
'clear_all_caches',
'clear_mem_cache',
]

__all__ += [
Expand Down
3 changes: 3 additions & 0 deletions qlat-utils/qlat_utils/cutils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ def get_all_caches_info():

def clear_all_caches():
cc.clear_all_caches()

def clear_mem_cache():
cc.clear_mem_cache()
10 changes: 7 additions & 3 deletions qlat-utils/qlat_utils/everything.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,13 @@ cdef extern from "qlat-utils/qar.h" namespace "qlat":

cdef extern from "qlat-utils/cache.h" namespace "qlat":

std_vector[std_string] get_all_caches_info()
void clear_all_caches()
void displayln_malloc_stats()
std_vector[std_string] get_all_caches_info() except +
void displayln_malloc_stats() except +

cdef extern from "qlat-utils/vector.h" namespace "qlat":

void clear_mem_cache() except +
void clear_all_caches() except +

### --------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion qlat-utils/qlat_utils/include/qlat-utils/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ inline void* alloc_mem(const Long min_size, const bool is_acc = false)
fname + ssprintf(": alloc %.3lf (GB) memory (current total %.3lf (GB))",
(double)min_size / (1024.0 * 1024.0 * 1024.0),
(double)ms.total() / (1024.0 * 1024.0 * 1024.0)));
clear_all_caches();
clear_mem_cache();
displayln_info(
fname + ssprintf(": after clear mem_cache (current total %.3lf (GB))",
(double)ms.total() / (1024.0 * 1024.0 * 1024.0)));
Expand Down
2 changes: 2 additions & 0 deletions qlat/qlat/scripts/topo_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def load():
else:
gf = q.GaugeField()
gf.load(p_source)
q.clear_all_caches()
q.clear_mem_cache()
return gf

gf = load()
Expand Down
2 changes: 2 additions & 0 deletions qlat/qlat/scripts/topo_measure_wilson_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def load():
else:
gf = q.GaugeField()
gf.load(p_source)
q.clear_all_caches()
q.clear_mem_cache()
return gf

gf = load()
Expand Down

0 comments on commit ded2c59

Please sign in to comment.