diff --git a/bin/valgrind-out.txt b/bin/valgrind-out.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2cf47079de552f7faf4d347441106be3ea8f64f --- /dev/null +++ b/bin/valgrind-out.txt @@ -0,0 +1,437 @@ +==3479943== Memcheck, a memory error detector +==3479943== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==3479943== Using Valgrind-3.18.1-42b08ed5bd-20211015 and LibVEX; rerun with -h for copyright info +==3479943== Command: ./summa_be -g 1 1 -c /code/laugh_tests/test_cases/settings/syntheticTestCases/celia1990/Summa_Actors_Settings_celia1990.json +==3479943== Parent PID: 2825852 +==3479943== +--3479943-- +--3479943-- Valgrind options: +--3479943-- --leak-check=full +--3479943-- --show-leak-kinds=all +--3479943-- --track-origins=yes +--3479943-- --verbose +--3479943-- --log-file=valgrind-out.txt +--3479943-- Contents of /proc/version: +--3479943-- Linux version 6.5.0-28-generic (buildd@lcy02-amd64-098) (x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 +--3479943-- +--3479943-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand-rdseed +--3479943-- Page sizes: currently 4096, max supported 4096 +--3479943-- Valgrind library directory: /usr/libexec/valgrind +--3479943-- Reading syms from /code/Summa-Actors/bin/summa_be +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 +--3479943-- Considering /usr/lib/debug/.build-id/15/921ea631d9f36502d20459c43e5c85b7d6ab76.debug .. +--3479943-- .. build-id is valid +--3479943-- Reading syms from /usr/libexec/valgrind/memcheck-amd64-linux +--3479943-- object doesn't have a symbol table +--3479943-- object doesn't have a dynamic symbol table +--3479943-- Scheduler: using generic scheduler lock implementation. +--3479943-- Reading suppressions file: /usr/libexec/valgrind/default.supp +==3479943== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-3479943-by-???-on-4ce5b29ed7b1 +==3479943== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-3479943-by-???-on-4ce5b29ed7b1 +==3479943== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-3479943-by-???-on-4ce5b29ed7b1 +==3479943== +==3479943== TO CONTROL THIS PROCESS USING vgdb (which you probably +==3479943== don't want to do, unless you know exactly what you're doing, +==3479943== or are doing some strange experiment): +==3479943== /usr/bin/vgdb --pid=3479943 ...command... +==3479943== +==3479943== TO DEBUG THIS PROCESS USING GDB: start GDB like this +==3479943== /path/to/gdb ./summa_be +==3479943== and then give GDB the following command +==3479943== target remote | /usr/bin/vgdb --pid=3479943 +==3479943== --pid is optional if only one valgrind process is running +==3479943== +--3479943-- REDIR: 0x402aa40 (ld-linux-x86-64.so.2:strlen) redirected to 0x580bcec2 (???) +--3479943-- REDIR: 0x402a810 (ld-linux-x86-64.so.2:index) redirected to 0x580bcedc (???) +--3479943-- Reading syms from /usr/libexec/valgrind/vgpreload_core-amd64-linux.so +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so +--3479943-- object doesn't have a symbol table +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x0402aa40 (strlen ) R-> (0000.0) 0x580bcec2 ??? +--3479943-- new: 0x0402aa40 (strlen ) R-> (2007.0) 0x0484ee30 strlen +--3479943-- REDIR: 0x4027220 (ld-linux-x86-64.so.2:strcmp) redirected to 0x484fcd0 (strcmp) +--3479943-- REDIR: 0x402afa0 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x4853840 (mempcpy) +--3479943-- Reading syms from /usr/local/lib/libcaf_io.so.0.18.6 +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libnetcdf.so.19 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /code/Summa-Actors/build/cmake_build/libsummaactors.so +--3479943-- Reading syms from /usr/local/lib/libcaf_core.so.0.18.6 +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libm.so.6 +--3479943-- Considering /usr/lib/debug/.build-id/a8/8ef0199bd5e742ebd0c359edf5cb2be0ec08b5.debug .. +--3479943-- .. build-id is valid +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libc.so.6 +--3479943-- Considering /usr/lib/debug/.build-id/c2/89da5071a3399de893d2af81d6a30c62646e1e.debug .. +--3479943-- .. build-id is valid +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x059c9c60 (memalign ) R-> (1011.0) 0x0484e080 memalign +--3479943-- new: 0x059c9c60 (memalign ) R-> (1017.0) 0x0484e050 aligned_alloc +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x059c9c60 (memalign ) R-> (1011.0) 0x0484e080 memalign +--3479943-- new: 0x059c9c60 (memalign ) R-> (1017.0) 0x0484e020 aligned_alloc +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x059c9c60 (memalign ) R-> (1011.0) 0x0484e080 memalign +--3479943-- new: 0x059c9c60 (memalign ) R-> (1017.0) 0x0484e050 aligned_alloc +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x059c9c60 (memalign ) R-> (1011.0) 0x0484e080 memalign +--3479943-- new: 0x059c9c60 (memalign ) R-> (1017.0) 0x0484e020 aligned_alloc +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so.100.1.4 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libcurl.so.4.7.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libnetcdff.so.7.1.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libcrypto.so.3 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libsz.so.2.0.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libz.so.1.2.11 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14.20.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libidn2.so.0.3.7 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/librtmp.so.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libssh.so.4.8.7 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libpsl.so.5.3.2 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libssl.so.3 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libldap-2.5.so.0.1.11 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/liblber-2.5.so.0.1.11 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libzstd.so.1.4.8 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1.0.9 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libaec.so.0.0.12 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libunistring.so.2.2.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libgnutls.so.30.31.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libhogweed.so.6.4 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libnettle.so.8.4 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libcom_err.so.2.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1.0.9 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.3.0 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libtasn1.so.6.6.2 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libkeyutils.so.1.9 +--3479943-- object doesn't have a symbol table +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libresolv.so.2 +--3479943-- Considering /usr/lib/debug/.build-id/41/77015ccbe670995ed128899633b71e6ca397ef.debug .. +--3479943-- .. build-id is valid +--3479943-- Reading syms from /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0 +--3479943-- object doesn't have a symbol table +--3479943-- REDIR: 0x59cc720 (libc.so.6:strnlen) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc9e0 (libc.so.6:strpbrk) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc2e0 (libc.so.6:strcmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59eacd0 (libc.so.6:wcsnlen) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd6d0 (libc.so.6:memset) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59e9540 (libc.so.6:wcslen) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cdc10 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59e9370 (libc.so.6:wcschr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc260 (libc.so.6:index) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc960 (libc.so.6:rindex) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd5a0 (libc.so.6:memmove) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +==3479943== Preferring higher priority redirection: +--3479943-- old: 0x05ac47c0 (__memcpy_avx_unalign) R-> (2018.0) 0x04850f90 __memcpy_avx_unaligned_erms +--3479943-- new: 0x05ac47c0 (__memcpy_avx_unalign) R-> (2018.1) 0x04852880 memmove +--3479943-- REDIR: 0x59e93f0 (libc.so.6:wcscmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd9e0 (libc.so.6:stpncpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59e99b0 (libc.so.6:wmemchr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc830 (libc.so.6:strncmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cda70 (libc.so.6:strcasecmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc420 (libc.so.6:strcspn) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59e9470 (libc.so.6:wcscpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc1d0 (libc.so.6:strcat) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cdb60 (libc.so.6:strncasecmp_l) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd480 (libc.so.6:bcmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59d5570 (libc.so.6:memrchr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cf010 (libc.so.6:strchrnul) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc390 (libc.so.6:strcpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cdb10 (libc.so.6:strcasecmp_l) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc6a0 (libc.so.6:strlen) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc8d0 (libc.so.6:strncpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd950 (libc.so.6:stpcpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd3f0 (libc.so.6:memchr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59ccb00 (libc.so.6:strspn) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd7d0 (libc.so.6:mempcpy) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cdac0 (libc.so.6:strncasecmp) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cef80 (libc.so.6:rawmemchr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cc7a0 (libc.so.6:strncat) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x5a58280 (libc.so.6:__memcpy_chk) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x59cd310 (libc.so.6:strstr) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +--3479943-- REDIR: 0x5a583b0 (libc.so.6:__memmove_chk) redirected to 0x483f220 (_vgnU_ifunc_wrapper) +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x05ac4790 (__memcpy_chk_avx_una) R-> (2030.0) 0x04853940 __memcpy_chk +--3479943-- new: 0x05ac4790 (__memcpy_chk_avx_una) R-> (2024.0) 0x048532c0 __memmove_chk +==3479943== WARNING: new redirection conflicts with existing -- ignoring it +--3479943-- old: 0x05ac4790 (__memcpy_chk_avx_una) R-> (2030.0) 0x04853940 __memcpy_chk +--3479943-- new: 0x05ac4790 (__memcpy_chk_avx_una) R-> (2024.0) 0x048532c0 __memmove_chk +--3479943-- REDIR: 0x5ac1610 (libc.so.6:__strrchr_avx2) redirected to 0x484e810 (rindex) +--3479943-- REDIR: 0x5ac17e0 (libc.so.6:__strlen_avx2) redirected to 0x484ed10 (strlen) +--3479943-- REDIR: 0x5ac1180 (libc.so.6:__strchr_avx2) redirected to 0x484e9f0 (index) +--3479943-- REDIR: 0x5abc940 (libc.so.6:__strcmp_avx2) redirected to 0x484fbd0 (strcmp) +--3479943-- REDIR: 0x59c90a0 (libc.so.6:malloc) redirected to 0x4848820 (malloc) +--3479943-- REDIR: 0x5abda80 (libc.so.6:__memcmp_avx2_movbe) redirected to 0x4852010 (bcmp) +--3479943-- REDIR: 0x5ac47c0 (libc.so.6:__memcpy_avx_unaligned_erms) redirected to 0x4852880 (memmove) +--3479943-- REDIR: 0x59ca520 (libc.so.6:calloc) redirected to 0x484d9d0 (calloc) +--3479943-- REDIR: 0x5ac4790 (libc.so.6:__memcpy_chk_avx_unaligned_erms) redirected to 0x4853940 (__memcpy_chk) +--3479943-- REDIR: 0x59c93e0 (libc.so.6:free) redirected to 0x484b210 (free) +--3479943-- REDIR: 0x5ac4f80 (libc.so.6:__memset_avx2_unaligned_erms) redirected to 0x4852770 (memset) +--3479943-- REDIR: 0x5ac3040 (libc.so.6:__strncpy_avx2) redirected to 0x484efe0 (strncpy) +--3479943-- REDIR: 0x5ac1400 (libc.so.6:__strchrnul_avx2) redirected to 0x4853330 (strchrnul) +--3479943-- REDIR: 0x569f970 (libstdc++.so.6:operator new(unsigned long)) redirected to 0x4848fa0 (operator new(unsigned long)) +--3479943-- REDIR: 0x5abd2c0 (libc.so.6:__memchr_avx2) redirected to 0x484fd50 (memchr) +--3479943-- REDIR: 0x569dc20 (libstdc++.so.6:operator delete(void*, unsigned long)) redirected to 0x484bb00 (operator delete(void*, unsigned long)) +--3479943-- REDIR: 0x569f9d0 (libstdc++.so.6:operator new[](unsigned long)) redirected to 0x484a280 (operator new[](unsigned long)) +--3479943-- REDIR: 0x5ac2cb0 (libc.so.6:__strcpy_avx2) redirected to 0x484ee60 (strcpy) +--3479943-- REDIR: 0x569dc40 (libstdc++.so.6:operator delete[](void*)) redirected to 0x484ca20 (operator delete[](void*)) +--3479943-- REDIR: 0x569dc10 (libstdc++.so.6:operator delete(void*)) redirected to 0x484b840 (operator delete(void*)) +--3479943-- REDIR: 0x59ccfc0 (libc.so.6:__GI_strstr) redirected to 0x4853ae0 (__strstr_sse2) +--3479943-- REDIR: 0x5ac4780 (libc.so.6:__mempcpy_avx_unaligned_erms) redirected to 0x4853440 (mempcpy) +--3479943-- REDIR: 0x5ac1960 (libc.so.6:__strnlen_avx2) redirected to 0x484ecb0 (strnlen) +--3479943-- REDIR: 0x5abf7b0 (libc.so.6:__strncasecmp_avx) redirected to 0x484f640 (strncasecmp) +--3479943-- REDIR: 0x5abcd80 (libc.so.6:__strncmp_avx2) redirected to 0x484f3e0 (strncmp) +--3479943-- REDIR: 0x59c9740 (libc.so.6:realloc) redirected to 0x484dc50 (realloc) +--3479943-- REDIR: 0x5abd590 (libc.so.6:__rawmemchr_avx2) redirected to 0x4853360 (rawmemchr) +==3479943== +==3479943== HEAP SUMMARY: +==3479943== in use at exit: 10,563 bytes in 22 blocks +==3479943== total heap usage: 33,349 allocs, 33,327 frees, 3,407,905 bytes allocated +==3479943== +==3479943== Searching for pointers to 22 not-freed blocks +==3479943== Checked 1,622,424 bytes +==3479943== +==3479943== 5 bytes in 1 blocks are still reachable in loss record 1 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x59CC58E: strdup (strdup.c:42) +==3479943== by 0x4AC1DF0: NCDISPATCH_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1EE3: nc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 6 bytes in 1 blocks are still reachable in loss record 2 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x59CC58E: strdup (strdup.c:42) +==3479943== by 0x4AC1E11: NCDISPATCH_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1EE3: nc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 8 bytes in 1 blocks are still reachable in loss record 3 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x5BFA7C1: ??? (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5BFA7F8: ??? (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5BB6C96: H5_term_library (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5969494: __run_exit_handlers (exit.c:113) +==3479943== by 0x596960F: exit (exit.c:143) +==3479943== by 0x594DD96: (below main) (libc_start_call_main.h:74) +==3479943== +==3479943== 8 bytes in 1 blocks are still reachable in loss record 4 of 16 +==3479943== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x5E14D96: H5TS_cancel_count_inc (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5C44E00: H5Eget_auto2 (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5BB6CA4: H5_term_library (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5969494: __run_exit_handlers (exit.c:113) +==3479943== by 0x596960F: exit (exit.c:143) +==3479943== by 0x594DD96: (below main) (libc_start_call_main.h:74) +==3479943== +==3479943== 23 bytes in 1 blocks are still reachable in loss record 5 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x59CC58E: strdup (strdup.c:42) +==3479943== by 0x4AC1E37: NCDISPATCH_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1EE3: nc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 36 bytes in 1 blocks are still reachable in loss record 6 of 16 +==3479943== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4AC5975: ncbytessetalloc (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC5B4B: ncbytesappendn (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC5C0B: ncbytescat (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4B03869: ??? (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1F1F: nc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== +==3479943== 37 bytes in 1 blocks are still reachable in loss record 7 of 16 +==3479943== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4AC5975: ncbytessetalloc (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC5B4B: ncbytesappendn (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC5C0B: ncbytescat (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4B433A3: ??? (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4B43447: NCZ_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== +==3479943== 64 bytes in 1 blocks are still reachable in loss record 8 of 16 +==3479943== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4ACA36E: ncrc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4ACA3A8: ncrc_getglobalstate (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1DE1: NCDISPATCH_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC1EE3: nc_initialize (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC2480: NC_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x4AC26A7: nc_open (in /usr/lib/x86_64-linux-gnu/libnetcdf.so.19) +==3479943== by 0x1BB635: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:16) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 88 bytes in 1 blocks are still reachable in loss record 9 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x501AA9F: init_gru_struc (gru_struc.f90:15) +==3479943== by 0x1BB8BD: gruStruc::gruStruc(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (gru_struc.cpp:42) +==3479943== by 0x26E1EB: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:55) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x5366748: caf::event_based_actor::initialize() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543CC5E: caf::scheduled_actor::activate(caf::execution_unit*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543A31F: caf::scheduled_actor::resume(caf::execution_unit*, unsigned long) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x524A964: caf::scheduler::worker<caf::policy::work_stealing>::run() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 128 bytes in 7 blocks are indirectly lost in loss record 10 of 16 +==3479943== at 0x484A2F3: operator new[](unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x11F0B9: main (main.cpp:238) +==3479943== +==3479943== 184 (56 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 16 +==3479943== at 0x484A2F3: operator new[](unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x11F05A: main (main.cpp:236) +==3479943== +==3479943== 1,848 bytes in 1 blocks are still reachable in loss record 12 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x5C37111: H5E__get_stack (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5C43A54: H5E_clear_stack (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5C44E37: H5Eget_auto2 (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5BB6CA4: H5_term_library (in /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103.3.0) +==3479943== by 0x5969494: __run_exit_handlers (exit.c:113) +==3479943== by 0x596960F: exit (exit.c:143) +==3479943== by 0x594DD96: (below main) (libc_start_call_main.h:74) +==3479943== +==3479943== 2,064 bytes in 1 blocks are definitely lost in loss record 13 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4F4CBC8: __ascii_util_module_MOD_get_vlines (ascii_util.f90:167) +==3479943== by 0x4F4F29E: __summafilemanager_MOD_summa_settimesdirsandfiles (summaFileManager.f90:95) +==3479943== by 0x4DF8E60: initFileManagerModule_fortran (batch_distributer_actor.f90:33) +==3479943== by 0x1BA48E: fileManager::initFileManagerModule[abi:cxx11]() (fileManager.cpp:83) +==3479943== by 0x26E047: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:43) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x5366748: caf::event_based_actor::initialize() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543CC5E: caf::scheduled_actor::activate(caf::execution_unit*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 2,064 bytes in 1 blocks are definitely lost in loss record 14 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4F4CC32: __ascii_util_module_MOD_get_vlines (ascii_util.f90:167) +==3479943== by 0x4F4F29E: __summafilemanager_MOD_summa_settimesdirsandfiles (summaFileManager.f90:95) +==3479943== by 0x4DF8E60: initFileManagerModule_fortran (batch_distributer_actor.f90:33) +==3479943== by 0x1BA48E: fileManager::initFileManagerModule[abi:cxx11]() (fileManager.cpp:83) +==3479943== by 0x26E047: caf::summa_actor(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor) (summa_actor.cpp:43) +==3479943== by 0x1B0B72: decltype ({parm#1}((forward<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>)({parm#4}), move((get<0l>)({parm#3})), move((get<1l>)({parm#3})), move((get<2l>)({parm#3})), move((get<3l>)({parm#3})), move((get<4l>)({parm#3})), move((get<5l>)({parm#3})), move((get<6l>)({parm#3})))) caf::detail::apply_moved_args_prefixed<caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), 0l, 1l, 2l, 3l, 4l, 5l, 6l, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&>(caf::behavior (*&)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), caf::detail::int_list<0l, 1l, 2l, 3l, 4l, 5l, 6l>, std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>&, caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*&) (apply_args.hpp:64) +==3479943== by 0x1AFC38: caf::detail::init_fun_factory_helper<caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>, caf::behavior (*)(caf::stateful_actor<caf::summa_actor_state, caf::event_based_actor>*, int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor), std::tuple<int, int, Summa_Actor_Settings, File_Access_Actor_Settings, Job_Actor_Settings, HRU_Actor_Settings, caf::actor>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:78) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x5366748: caf::event_based_actor::initialize() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543CC5E: caf::scheduled_actor::activate(caf::execution_unit*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 2,064 bytes in 1 blocks are definitely lost in loss record 15 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4F4CBC8: __ascii_util_module_MOD_get_vlines (ascii_util.f90:167) +==3479943== by 0x4F92883: __popmetadat_module_MOD_read_output_file (popMetadat.f90:780) +==3479943== by 0x4FDCB82: __popmetadat_module_MOD_popmetadat (popMetadat.f90:679) +==3479943== by 0x4DF61AF: __summa_globaldata_MOD_summa_defineglobaldata (summa_globalData.f90:113) +==3479943== by 0x4DF8D18: defineGlobalData_fortran (batch_distributer_actor.f90:53) +==3479943== by 0x26CBBA: caf::fortran_global_state_actor(caf::event_based_actor*) (fortran_global_state_actor.cpp:25) +==3479943== by 0x2729FA: caf::detail::init_fun_factory_helper<caf::event_based_actor, caf::behavior (*)(caf::event_based_actor*), std::tuple<>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:70) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x5366748: caf::event_based_actor::initialize() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543CC5E: caf::scheduled_actor::activate(caf::execution_unit*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== 2,064 bytes in 1 blocks are definitely lost in loss record 16 of 16 +==3479943== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) +==3479943== by 0x4F4CC32: __ascii_util_module_MOD_get_vlines (ascii_util.f90:167) +==3479943== by 0x4F92883: __popmetadat_module_MOD_read_output_file (popMetadat.f90:780) +==3479943== by 0x4FDCB82: __popmetadat_module_MOD_popmetadat (popMetadat.f90:679) +==3479943== by 0x4DF61AF: __summa_globaldata_MOD_summa_defineglobaldata (summa_globalData.f90:113) +==3479943== by 0x4DF8D18: defineGlobalData_fortran (batch_distributer_actor.f90:53) +==3479943== by 0x26CBBA: caf::fortran_global_state_actor(caf::event_based_actor*) (fortran_global_state_actor.cpp:25) +==3479943== by 0x2729FA: caf::detail::init_fun_factory_helper<caf::event_based_actor, caf::behavior (*)(caf::event_based_actor*), std::tuple<>, true, true>::operator()(caf::local_actor*) (init_fun_factory.hpp:70) +==3479943== by 0x529A084: caf::detail::unique_function<caf::behavior (caf::local_actor*)>::operator()(caf::local_actor*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x536684A: caf::event_based_actor::make_behavior() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x5366748: caf::event_based_actor::initialize() (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== by 0x543CC5E: caf::scheduled_actor::activate(caf::execution_unit*) (in /usr/local/lib/libcaf_core.so.0.18.6) +==3479943== +==3479943== LEAK SUMMARY: +==3479943== definitely lost: 8,312 bytes in 5 blocks +==3479943== indirectly lost: 128 bytes in 7 blocks +==3479943== possibly lost: 0 bytes in 0 blocks +==3479943== still reachable: 2,123 bytes in 10 blocks +==3479943== suppressed: 0 bytes in 0 blocks +==3479943== +==3479943== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0) diff --git a/build/includes/file_access_actor/file_access_actor.hpp b/build/includes/file_access_actor/file_access_actor.hpp index ae8e3604721a8fc83a28ebcd9a1e42c4192299fe..4b18fe2102d039e1d00bb370e9c7bab2921220c4 100644 --- a/build/includes/file_access_actor/file_access_actor.hpp +++ b/build/includes/file_access_actor/file_access_actor.hpp @@ -22,14 +22,6 @@ extern "C" { int* num_timesteps_output_buffer, void* handle_output_ncid, int* startGRU, int* numGRU, int* numHRU, int* err); - // void getNumForcingFiles_fortran(int* num_files); - - // void getFileInfoSizes_fortran(int& iFile, int& var_ix_size, int& data_id_size, - // int& varName_size); - - // void getFileInfoCopy_fortran(int& iFile, void* name); - - void defOutputFortran(void* handle_ncid, int* start_gru, int* num_gru, int* num_hru, int* file_gru, bool* use_extention, char const* output_extention, int* err); @@ -38,11 +30,10 @@ extern "C" { void writeOutput_fortran(void* handle_ncid, int* num_steps, int* start_gru, int* max_gru, bool* writeParamFlag, int* err); - void read_forcingFile(void* forcFileInfo, int* currentFile, int* stepsInFile, - int* startGRU, int* numGRU, int* err); + // void read_forcingFile(void* forcFileInfo, int* currentFile, int* stepsInFile, + // int* startGRU, int* numGRU, int* err); - void FileAccessActor_DeallocateStructures(void* handle_forcFileInfo, - void* handle_ncid); + void FileAccessActor_DeallocateStructures(void* handle_ncid); } @@ -50,19 +41,19 @@ extern "C" { * File Access Actor state variables *********************************************/ -class outputStructureLifetime { - public: - void* handle_forcFileInfo; - void* handle_ncid; - outputStructureLifetime(void* handle_forcFileInfo, void* handle_ncid) { - this->handle_forcFileInfo = handle_forcFileInfo; - this->handle_ncid = handle_ncid; - } - ~outputStructureLifetime() { - std::cout << "Deallocating output structures\n"; - FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid); - } -}; +// class outputStructureLifetime { +// public: +// void* handle_forcFileInfo; +// void* handle_ncid; +// outputStructureLifetime(void* handle_forcFileInfo, void* handle_ncid) { +// this->handle_forcFileInfo = handle_forcFileInfo; +// this->handle_ncid = handle_ncid; +// } +// ~outputStructureLifetime() { +// std::cout << "Deallocating output structures\n"; +// FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid); +// } +// }; struct file_access_state { // Variables set on Spawn @@ -73,7 +64,7 @@ struct file_access_state { NumGRUInfo num_gru_info; - void *handle_forcing_file_info = new_handle_file_info(); // Handle for the forcing file information + // void *handle_forcing_file_info = new_handle_file_info(); // Handle for the forcing file information void *handle_ncid = new_handle_var_i(); // output file ids int num_vectors_in_output_manager; int num_steps; @@ -87,12 +78,13 @@ struct file_access_state { File_Access_Actor_Settings file_access_actor_settings; std::vector<Forcing_File_Info> forcing_file_list; // list of steps in file + std::unique_ptr<forcingFileContainer> forcing_files; - // Timing Variables + // Timing Variables TimingInfo file_access_timing; - std::unique_ptr<outputStructureLifetime> output_lifetime; + // std::unique_ptr<outputStructureLifetime> output_lifetime; bool write_params_flag = true; diff --git a/build/includes/file_access_actor/forcing_file_info.hpp b/build/includes/file_access_actor/forcing_file_info.hpp index 9be83f1c73a2f7baaa7c0f09e45c87ff50e82cf4..bf8d75154656bb61d31a3314ba2c842e9a020423 100644 --- a/build/includes/file_access_actor/forcing_file_info.hpp +++ b/build/includes/file_access_actor/forcing_file_info.hpp @@ -5,12 +5,21 @@ #include <iostream> extern "C" { + // Creation and population of Fortran structures void getNumForcingFiles_fortran(int* num_files); void getFileInfoSizes_fortran(int& iFile, int& var_ix_size, int& data_id_size, int& varName_size); - void getFileInfoCopy_fortran(int& iFile, void* file_name, int* var_name_size, - void* var_name_arr); + void getFileInfoCopy_fortran(int& iFile, void* file_name, int& nVars, + int& nTimeSteps, int& var_name_size, int& var_ix_size, int& data_id_size, + void* var_name_arr, void* var_ix_arr, void* data_id_arr, + double& firstJulDay, double& convTime2Days); + // File Loading + void read_forcingFile(int& iFile, int& start_gru, int& num_gru, + int& err, void* message); + + // Deallocate Fortran Structures + void freeForcingFiles_fortran(); } /** @@ -19,6 +28,7 @@ extern "C" { */ class fileInfo { public: + /** Fortran Replication Part **/ std::string filenmData; // name of data file int nVars; // number of variables in file int nTimeSteps; // number of time steps in file @@ -27,16 +37,29 @@ class fileInfo { std::vector<std::string> varName; // netcdf variable name for each forcing data variable double firstJulDay; // first julian day in forcing file double convTime2Days; // conversion factor to convert time units to days - + /** Fortran Replication Part **/ + + /** C++ Part **/ + bool is_loaded; + fileInfo(); }; class forcingFileContainer { public: std::vector<fileInfo> forcing_files_; - forcingFileContainer(); - ~forcingFileContainer(){}; + ~forcingFileContainer(); + + int loadForcingFile(int file_ID, int start_gru, int num_gru); + bool isFileLoaded(int file_ID); + inline bool allFilesLoaded() { + return files_loaded_ == forcing_files_.size(); + } + inline int getNumSteps(int iFile) {return forcing_files_[iFile-1].nTimeSteps;} + + private: + int files_loaded_; }; @@ -58,11 +81,3 @@ class Forcing_File_Info { void updateNumSteps(int num_steps); }; - -struct Forcing_Info { - int num_vars; - int num_timesteps; - std::vector<int> index_forc_var; - std::vector<int> ncid_var; - -}; \ No newline at end of file diff --git a/build/includes/global/message_atoms.hpp b/build/includes/global/message_atoms.hpp index 3c61047f73a5399a37d06132af44dc32ca49b86a..d66b742501998879121d8990efb4a49901e0cc7b 100644 --- a/build/includes/global/message_atoms.hpp +++ b/build/includes/global/message_atoms.hpp @@ -197,6 +197,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(summa, first_custom_type_id) CAF_ADD_ATOM(summa, def_output) CAF_ADD_ATOM(summa, load_balance) CAF_ADD_ATOM(summa, file_access_actor_ready) + CAF_ADD_ATOM(summa, global_data_ready) // Sender: job_actor // Reciever: summa_actor diff --git a/build/includes/summa_actor/summa_actor.hpp b/build/includes/summa_actor/summa_actor.hpp index 2249d054d339620b5d7463375dee20bb68585623..b005923ea3f301d989a4a706af73be9e534b2523 100644 --- a/build/includes/summa_actor/summa_actor.hpp +++ b/build/includes/summa_actor/summa_actor.hpp @@ -10,6 +10,7 @@ #include <chrono> #include <string> #include <vector> +#include "message_atoms.hpp" extern "C" { void defineGlobalData_fortran(int* err, void* err_msg); @@ -17,6 +18,18 @@ extern "C" { void deallocateGlobalData_fortran(int* err, void* err_msg); } +// This is a class that wraps around the data created in +// defineGlobalData() +class summaGlobalData { + public: + summaGlobalData(); + ~summaGlobalData(); + + int defineGlobalData(); + private: + bool global_data_ready; +}; + namespace caf { @@ -46,7 +59,7 @@ struct summa_actor_state { int current_batch_id; std::unique_ptr<fileManager> file_manager; - actor fortran_state; + std::unique_ptr<summaGlobalData> global_fortran_state; // settings for all child actors (save in case we need to recover) @@ -64,10 +77,7 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, Job_Actor_Settings job_actor_settings, HRU_Actor_Settings hru_actor_settings, actor parent); -behavior fortran_global_state_actor(event_based_actor* self); - - - +behavior fortran_global_state_actor(event_based_actor* self, actor parent); void spawnJob(stateful_actor<summa_actor_state>* self); @@ -82,3 +92,5 @@ void spawnJob(stateful_actor<summa_actor_state>* self); int getNumGRUInFile(const std::string &settingsPath, const std::string &attributeFile); + + diff --git a/build/source/file_access_actor/file_access_actor.cpp b/build/source/file_access_actor/file_access_actor.cpp index 1e539adcc586e3c73e00cacde8401dd9e2890c2d..e086587ed3712f8f5ca61f8c7e32459529839045 100644 --- a/build/source/file_access_actor/file_access_actor.cpp +++ b/build/source/file_access_actor/file_access_actor.cpp @@ -50,43 +50,9 @@ behavior file_access_actor( &err); if (err != 0) return -1; - self->state.output_lifetime = std::make_unique<outputStructureLifetime>( - self->state.handle_forcing_file_info, self->state.handle_ncid); - // Forcing File Info - // getNumForcingFiles_fortran(&self->state.numFiles); - auto forcing_container = new forcingFileContainer(); - return -2; - // std::vector<fileInfo> forcFileInfo; - // forcFileInfo.reserve(self->state.numFiles); - // for (int i = 1; i <= self->state.numFiles; i++) { - // int var_ix_size = 0; - // int data_id_size = 0; - // int varName_size = 0; - // getFileInfoSizes_fortran(i, var_ix_size, data_id_size, varName_size); - // aout(self) << "File: " << i << " Var_ix_size: " << var_ix_size - // << " Data_id_size: " << data_id_size - // << " VarName_size: " << varName_size << std::endl; - - - // std::unique_ptr<char[]> file_name(new char[256]); - // // getFileInfoCopy_fortran(i, &file_name); - // std::string file_name_str(file_name.get()); - // aout(self) << "File Name: " << file_name_str << std::endl; - // } - - // // Serialize forcing_file_info - // auto forcing_file_info = - // fileInfo(self->state.handle_forcing_file_info); - self->quit(); - return -2; - - // Initalize the forcingFile array - self->state.filesLoaded = 0; - for (int i = 1; i <= self->state.numFiles; i++) { - self->state.forcing_file_list.push_back(Forcing_File_Info(i)); - } - + self->state.forcing_files = std::make_unique<forcingFileContainer>(); + // Ensure output buffer size is less than the number of simulation timesteps if (self->state.num_steps < fa_settings.num_timesteps_in_output_buffer) { self->state.num_output_steps = self->state.num_steps; @@ -121,67 +87,110 @@ behavior file_access_actor( return self->state.num_steps; }, + // Message from the HRU actor to get the forcing file that is loaded + [=](access_forcing, int iFile, caf::actor refToRespondTo) { + aout(self) << "ACCESS_FORCING\n" << iFile << "\n"; + if (self->state.forcing_files->allFilesLoaded()) { + self->send(refToRespondTo, new_forcing_file_v, + self->state.forcing_files->getNumSteps(iFile), iFile); + aout(self) << "All Forcing Files Loaded \n"; + return; + } + // TODO: THis timing coudl probably be handled inside the loadForcingFile? + self->state.file_access_timing.updateStartPoint("read_duration"); + auto err = self->state.forcing_files->loadForcingFile(iFile, + self->state.start_gru, self->state.num_gru); + self->state.file_access_timing.updateEndPoint("read_duration"); + + if (err != 0) { + aout(self) << "ERROR: Reading Forcing" << std::endl; + self->quit(); + return; + } + if (!self->state.forcing_files->allFilesLoaded()) { + self->send(self, access_forcing_internal_v, iFile + 1); + } - // Message from the HRU actor to get the forcing file that is loaded - [=](access_forcing, int currentFile, caf::actor refToRespondTo) { - if (currentFile <= self->state.numFiles) { - // Note: C++ starts at 0 and Fortran starts at 1 - if(!self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { - self->state.file_access_timing.updateStartPoint("read_duration"); - int err = 0; - read_forcingFile(self->state.handle_forcing_file_info, ¤tFile, - &self->state.stepsInCurrentFile, &self->state.start_gru, - &self->state.num_gru, &err); - if (err != 0) { - aout(self) << "ERROR: Reading Forcing" << std::endl; - } - self->state.filesLoaded += 1; - self->state.forcing_file_list[currentFile - 1] - .updateNumSteps(self->state.stepsInCurrentFile); - - self->state.file_access_timing.updateEndPoint("read_duration"); - // Check if all files have been loaded - if(self->state.filesLoaded <= self->state.numFiles) { - self->send(self, access_forcing_internal_v, currentFile + 1); - } - } + self->send(refToRespondTo, new_forcing_file_v, + self->state.forcing_files->getNumSteps(iFile), iFile); + + // if (currentFile <= self->state.numFiles) { + // // Note: C++ starts at 0 and Fortran starts at 1 + // if(!self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { + // self->state.file_access_timing.updateStartPoint("read_duration"); + // int err = 0; + // // read_forcingFile(self->state.handle_forcing_file_info, ¤tFile, + // // &self->state.stepsInCurrentFile, &self->state.start_gru, + // // &self->state.num_gru, &err); + // // if (err != 0) { + // // aout(self) << "ERROR: Reading Forcing" << std::endl; + // // } + // self->state.filesLoaded += 1; + // self->state.forcing_file_list[currentFile - 1] + // .updateNumSteps(self->state.stepsInCurrentFile); + + // self->state.file_access_timing.updateEndPoint("read_duration"); + // // Check if all files have been loaded + // if(self->state.filesLoaded <= self->state.numFiles) { + // self->send(self, access_forcing_internal_v, currentFile + 1); + // } + // } - self->send(refToRespondTo, new_forcing_file_v, - self->state.forcing_file_list[currentFile - 1].getNumSteps(), - currentFile); - } else { - aout(self) << currentFile << " exceeds the number of forcing files\n"; - } + // self->send(refToRespondTo, new_forcing_file_v, + // self->state.forcing_file_list[currentFile - 1].getNumSteps(), + // currentFile); + // } else { + // aout(self) << currentFile << " exceeds the number of forcing files\n"; + // } }, - [=](access_forcing_internal, int currentFile) { - if (self->state.filesLoaded <= self->state.numFiles && - currentFile <= self->state.numFiles) { + [=](access_forcing_internal, int iFile) { + aout(self) << "ACCESS_FORCING_INTERNAL\n"; + if (self->state.forcing_files->allFilesLoaded()) { + aout(self) << "All Forcing Files Loaded \n"; + return; + } + + self->state.file_access_timing.updateStartPoint("read_duration"); + auto err = self->state.forcing_files->loadForcingFile(iFile, + self->state.start_gru, self->state.num_gru); + self->state.file_access_timing.updateEndPoint("read_duration"); + if (err != 0) { + aout(self) << "ERROR: Reading Forcing" << std::endl; + self->quit(); + return; + } + self->send(self, access_forcing_internal_v, iFile + 1); + + + + // if (self->state.filesLoaded <= self->state.numFiles && + // currentFile <= self->state.numFiles) { - if (self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { - aout(self) << "Unexpected File Loaded!!\n"; - } + // if (self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { + // aout(self) << "Unexpected File Loaded!!\n"; + // } - self->state.file_access_timing.updateStartPoint("read_duration"); - int err = 0; - read_forcingFile(self->state.handle_forcing_file_info, ¤tFile, - &self->state.stepsInCurrentFile, &self->state.start_gru, - &self->state.num_gru, &err); - if (err != 0) { - aout(self) << "ERROR: Reading Forcing" << std::endl; - } + // self->state.file_access_timing.updateStartPoint("read_duration"); + // int err = 0; + // // read_forcingFile(self->state.handle_forcing_file_info, ¤tFile, + // // &self->state.stepsInCurrentFile, &self->state.start_gru, + // // &self->state.num_gru, &err); + // // if (err != 0) { + // // aout(self) << "ERROR: Reading Forcing" << std::endl; + // // } - self->state.filesLoaded += 1; - self->state.forcing_file_list[currentFile - 1] - .updateNumSteps(self->state.stepsInCurrentFile); + // self->state.filesLoaded += 1; + // self->state.forcing_file_list[currentFile - 1] + // .updateNumSteps(self->state.stepsInCurrentFile); - self->state.file_access_timing.updateEndPoint("read_duration"); - self->send(self, access_forcing_internal_v, currentFile + 1); - } else { - aout(self) << "All Forcing Files Loaded \n"; - } + // self->state.file_access_timing.updateEndPoint("read_duration"); + // self->send(self, access_forcing_internal_v, currentFile + 1); + // } else { + // aout(self) << "All Forcing Files Loaded \n"; + // } }, // Number of steps an HRU can compute before needing to write @@ -239,8 +248,7 @@ behavior file_access_actor( if (!self->state.num_gru_info.use_global_for_data_structures) { self->state.output_container->~Output_Container(); } - FileAccessActor_DeallocateStructures(self->state.handle_forcing_file_info, - self->state.handle_ncid); + FileAccessActor_DeallocateStructures(self->state.handle_ncid); aout(self) << "\n________________" << "FILE_ACCESS_ACTOR TIMING INFO RESULTS________________\n" diff --git a/build/source/file_access_actor/file_access_actor.f90 b/build/source/file_access_actor/file_access_actor.f90 index 85828220e282bc8b862d3bc090df966e4def54b1..112a70173d97c8625e343f27d14101253a01e4fd 100644 --- a/build/source/file_access_actor/file_access_actor.f90 +++ b/build/source/file_access_actor/file_access_actor.f90 @@ -379,51 +379,65 @@ else if(err/=0)then; print*, message; return; endif end subroutine fileAccessActor_init_fortran - +! TODO: Can be a function subroutine getNumForcingFiles_fortran(num_forc_files) bind(C, name="getNumForcingFiles_fortran") USE globalData,only:forcFileInfo implicit none integer(c_int),intent(out) :: num_forc_files - print*, "getting number of forcing files" num_forc_files = size(forcFileInfo) end subroutine getNumForcingFiles_fortran +! Get the sizes fo the vector components that make up a forcingFile subroutine getFileInfoSizes_fortran(iFile, var_ix_size, data_id_size, & varName_size) bind(C, name="getFileInfoSizes_fortran") USE globalData,only:forcFileInfo implicit none - integer(c_int),intent(in) :: iFile + integer(c_int),intent(in) :: iFile integer(c_int),intent(out) :: var_ix_size integer(c_int),intent(out) :: data_id_size integer(c_int),intent(out) :: varName_size - print*, "getting file info sizes" var_ix_size = size(forcFileInfo(iFile)%var_ix) data_id_size = size(forcFileInfo(iFile)%data_id) varName_size = size(forcFileInfo(iFile)%varName) end subroutine - -subroutine getFileInfoCopy_fortran(iFile, filenmData, varName_size, & - var_name_arr) bind(C, name="getFileInfoCopy_fortran") +! Get the file info for a specific file +subroutine getFileInfoCopy_fortran(iFile, filenmData, nVars, nTimeSteps, & + varName_size, var_ix_size, data_id_size, var_name_arr, var_ix_arr, & + data_id_arr, firstJulDay, convTime2Days) bind(C, name="getFileInfoCopy_fortran") USE globalData,only:forcFileInfo USE C_interface_module implicit none ! dummy variables integer(c_int),intent(in) :: iFile type(c_ptr),intent(out) :: filenmData + integer(c_int),intent(out) :: nVars + integer(c_int),intent(out) :: nTimeSteps integer(c_int),intent(in) :: varName_size + integer(c_int),intent(in) :: var_ix_size + integer(c_int),intent(in) :: data_id_size type(c_ptr),intent(out) :: var_name_arr(varName_size) + integer(c_int),intent(out) :: var_ix_arr(var_ix_size) + integer(c_int),intent(out) :: data_id_arr(data_id_size) + real(c_double),intent(out) :: firstJulDay + real(c_double),intent(out) :: convTime2Days ! local variables integer(i4b) :: i - ! Get File Name call f_c_string_ptr(trim(forcFileInfo(iFile)%filenmData), filenmData) + nVars = forcFileInfo(iFile)%nVars + nTimeSteps = forcFileInfo(iFile)%nTimeSteps + do i=1, varName_size call f_c_string_ptr(trim(forcFileInfo(iFile)%varName(i)), var_name_arr(i)) end do + var_ix_arr(:) = forcFileInfo(iFile)%var_ix(:) + data_id_arr(:) = forcFileInfo(iFile)%data_id(:) + firstJulDay = forcFileInfo(iFile)%firstJulDay + convTime2Days = forcFileInfo(iFile)%convTime2Days end subroutine getFileInfoCopy_fortran @@ -499,7 +513,13 @@ subroutine defOutputFortran(handle_output_ncid, start_gru, num_gru, num_hru, & end subroutine defOutputFortran -subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid) bind(C,name="FileAccessActor_DeallocateStructures") +subroutine freeForcingFiles_fortran() bind(C, name="freeForcingFiles_fortran") + USE globalData,only:forcFileInfo + implicit none + if (allocated(forcFileInfo)) deallocate(forcFileInfo) +end subroutine freeForcingFiles_fortran + +subroutine FileAccessActor_DeallocateStructures(handle_ncid) bind(C,name="FileAccessActor_DeallocateStructures") USE netcdf_util_module,only:nc_file_close USE globalData,only:structInfo ! information on the data structures USE access_forcing_module,only:forcingDataStruct @@ -509,7 +529,6 @@ subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid USE var_lookup,only:maxvarFreq ! maximum number of output files USE globalData,only:index_map implicit none - type(c_ptr),intent(in), value :: handle_forcFileInfo type(c_ptr),intent(in), value :: handle_ncid type(var_i),pointer :: ncid @@ -520,7 +539,6 @@ subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid integer(i4b) :: err call c_f_pointer(handle_ncid, ncid) - call c_f_pointer(handle_forcFileInfo, forcFileInfo) ! close the open output Files @@ -531,7 +549,6 @@ subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid ! endif ! end do - deallocate(forcFileInfo) deallocate(ncid) deallocate(outputTimeStep) deallocate(outputStructure) diff --git a/build/source/file_access_actor/forcing_file_info.cpp b/build/source/file_access_actor/forcing_file_info.cpp index 2294e3f558f7af9f6d1263e6f2fb80aab5ac70e1..78d530b4ac1a17cdb29ea1980b27a73178310911 100644 --- a/build/source/file_access_actor/forcing_file_info.cpp +++ b/build/source/file_access_actor/forcing_file_info.cpp @@ -28,22 +28,60 @@ forcingFileContainer::forcingFileContainer() { forcing_files_[i-1].data_id.resize(data_id_size); forcing_files_[i-1].varName.resize(varName_size); + // Allocate space for the file name and variable names std::unique_ptr<char[]> file_name(new char[256]); std::vector<std::unique_ptr<char[]>> var_name_arr; for (int j = 0; j < varName_size; j++) { var_name_arr.push_back(std::unique_ptr<char[]>(new char[256])); } - getFileInfoCopy_fortran(i, &file_name, &varName_size, var_name_arr.data()); + + getFileInfoCopy_fortran(i, &file_name, forcing_files_[i-1].nVars, + forcing_files_[i-1].nTimeSteps, varName_size, var_ix_size, + data_id_size, var_name_arr.data(), forcing_files_[i-1].var_ix.data(), + forcing_files_[i-1].data_id.data(), forcing_files_[i-1].firstJulDay, + forcing_files_[i-1].convTime2Days); + + forcing_files_[i-1].filenmData = std::string(file_name.get()); forcing_files_[i-1].nVars = varName_size; for (int j = 0; j < varName_size; j++) { forcing_files_[i-1].varName[j] = std::string(var_name_arr[j].get()); } - + } +} + + +forcingFileContainer::~forcingFileContainer() { + freeForcingFiles_fortran(); +} + + +int forcingFileContainer::loadForcingFile(int file_ID, int start_gru, + int num_gru) { + int err = 0; + if (forcing_files_[file_ID-1].is_loaded) { + return 0; + } + if (file_ID < 1 || file_ID > forcing_files_.size()) { + std::cout << "Error: Invalid file ID: " << file_ID << std::endl; + return -1; } + + std::unique_ptr<char[]> message(new char[256]); + read_forcingFile(file_ID, start_gru, num_gru, err, &message); + if (err != 0) { + std::cout << "Error reading forcing file: " << message.get() << std::endl; + return -2; + } + forcing_files_[file_ID-1].is_loaded = true; + files_loaded_++; + return 0; } +bool forcingFileContainer::isFileLoaded(int file_ID) { + return forcing_files_[file_ID-1].is_loaded; +} diff --git a/build/source/file_access_actor/read_force.f90 b/build/source/file_access_actor/read_force.f90 index 15f4f5c0d21117154daa8b42b6d085917af64965..e080e77fed6355a52c63827003d83804bf7ffc9e 100644 --- a/build/source/file_access_actor/read_force.f90 +++ b/build/source/file_access_actor/read_force.f90 @@ -12,6 +12,7 @@ USE data_types,only:dlength ! global data structure for forcing data USE data_types,only:ilength ! global data structure for forcing data USE actor_data_types,only:file_info_array USE actor_data_types,only:var_forc ! global data structure for forcing data +USE globalData,only:forcFileInfo ! forcing file info USE globalData,only:gru_struc USE globalData,only:time_meta,forc_meta ! metadata structures @@ -30,18 +31,18 @@ type(var_forc),allocatable,save,public :: forcingDataStruct(:) type(dlength),allocatable,save,public :: vecTime(:) contains -subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, numGRU, err) bind(C,name="read_forcingFile") - USE netcdf ! netcdf capability - USE netcdf_util_module,only:nc_file_open ! open netcdf file +subroutine read_forcingFile(iFile, startGRU, numGRU, err, message_r) & + bind(C,name="read_forcingFile") + USE netcdf + USE netcdf_util_module,only:nc_file_open + USE C_interface_module,only:f_c_string_ptr implicit none - type(c_ptr), intent(in), value :: handle_forcFileInfo integer(c_int),intent(in) :: iFile - integer(c_int),intent(inout) :: stepsInFile integer(c_int),intent(in) :: startGRU integer(c_int),intent(in) :: numGRU - integer(c_int),intent(inout) :: err + integer(c_int),intent(out) :: err + type(c_ptr), intent(out) :: message_r ! local varibles - type(file_info_array), pointer :: forcFileInfo integer(i4b) :: iHRU_Global integer(i4b) :: varId integer(i4b) :: ncid @@ -58,15 +59,13 @@ subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, n logical(lgt),dimension(size(forc_meta)) :: checkForce ! flags to check forcing data variables exist character(len=256) :: message ! error message - call c_f_pointer(handle_forcFileInfo, forcFileInfo) ! Start Procedure here - err=0; message="read_force.f90 - read_forcingFile/" - - nFiles=size(forcFileInfo%ffile_list(:)) - - nTimeSteps = sum(forcFileInfo%ffile_list(:)%nTimeSteps) + err=0; message="read_forcingFile/" + call f_c_string_ptr(message,message_r) + ! TODO: I wonder if I can wrap this in a shared pointer??? + nFiles=size(forcFileInfo(:)) ! Allocate forcing data input Struct if (.not.allocated(forcingDataStruct))then allocate(forcingDataStruct(nFiles)) @@ -75,31 +74,28 @@ subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, n endif ! Files are assumed to be in the correct order - infile=trim(FORCING_PATH)//trim(forcFileInfo%ffile_list(iFile)%filenmData) - ! open netCDF file - call openForcingFile(forcFileInfo%ffile_list,iFile,trim(infile),ncid,err,cmessage) - if(err/=0)then; message=trim(message)//trim(cmessage);return; end if + infile=trim(FORCING_PATH)//trim(forcFileInfo(iFile)%filenmData) + call openForcingFile(forcFileInfo(iFile),iFile,trim(infile),ncid,err,cmessage) + if(err/=0)then;message=trim(message)//trim(cmessage);call f_c_string_ptr(message,message_r);return; end if - err = nf90_inq_varid(ncid,'time',varId); if(err/=nf90_noerr)then; message=trim(message)//'cannot find time variable/'//trim(nf90_strerror(err)); return; endif - err = nf90_inquire_attribute(ncid,varId,'units',len = attLen); if(err/=nf90_noerr)then; message=trim(message)//'cannot find time units/'//trim(nf90_strerror(err)); return; endif - err = nf90_get_att(ncid,varid,'units',forcingDataStruct(iFile)%refTimeString);if(err/=nf90_noerr)then; message=trim(message)//'cannot read time units/'//trim(nf90_strerror(err)); return; endif - - - nTimeSteps = forcFileInfo%ffile_list(iFile)%nTimeSteps + err = nf90_inq_varid(ncid,'time',varId); if(err/=nf90_noerr)then; message=trim(message)//'cannot find time variable/'//trim(nf90_strerror(err));call f_c_string_ptr(message,message_r);return; endif + err = nf90_inquire_attribute(ncid,varId,'units',len = attLen); if(err/=nf90_noerr)then; message=trim(message)//'cannot find time units/'//trim(nf90_strerror(err));call f_c_string_ptr(message,message_r);return; endif + err = nf90_get_att(ncid,varid,'units',forcingDataStruct(iFile)%refTimeString);if(err/=nf90_noerr)then; message=trim(message)//'cannot read time units/'//trim(nf90_strerror(err));call f_c_string_ptr(message,message_r);return; endif + + nTimeSteps = forcFileInfo(iFile)%nTimeSteps forcingDataStruct(iFile)%nTimeSteps = nTimeSteps - stepsInFile = nTimeSteps if(.not.allocated(vecTime(iFile)%dat))then allocate(vecTime(iFile)%dat(nTimeSteps)) end if ! Get Time Information err = nf90_inq_varid(ncid,'time',varId); - if(err/=nf90_noerr)then; message=trim(message)//'trouble finding time variable/'//trim(nf90_strerror(err)); return; endif + if(err/=nf90_noerr)then; message=trim(message)//'trouble finding time variable/'//trim(nf90_strerror(err)); call f_c_string_ptr(message,message_r); return; endif err = nf90_get_var(ncid,varId,vecTime(iFile)%dat(:),start=(/1/),count=(/nTimeSteps/)) - if(err/=nf90_noerr)then; message=trim(message)//'trouble reading time variable/'//trim(nf90_strerror(err)); return; endif + if(err/=nf90_noerr)then; message=trim(message)//'trouble reading time variable/'//trim(nf90_strerror(err)); call f_c_string_ptr(message,message_r); return; endif ! Need to loop through vars and add forcing data - nVars = forcFileInfo%ffile_list(iFile)%nVars + nVars = forcFileInfo(iFile)%nVars forcingDataStruct(iFile)%nVars = nVars if (.not.allocated(forcingDataStruct(iFile)%var))then allocate(forcingDataStruct(iFile)%var(nVars)) @@ -114,13 +110,12 @@ subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, n checkForce(iLookFORCE%time) = .true. ! time is handled separately do iNC=1,nVars ! populate var_ix so HRUs can access the values - forcingDataStruct(iFile)%var_ix(iNC) = forcFileInfo%ffile_list(iFile)%var_ix(iNC) + forcingDataStruct(iFile)%var_ix(iNC) = forcFileInfo(iFile)%var_ix(iNC) ! check variable is desired - if(forcFileInfo%ffile_list(iFile)%var_ix(iNC)==integerMissing) cycle - + if(forcFileInfo(iFile)%var_ix(iNC)==integerMissing) cycle - iVar = forcFileInfo%ffile_list(iFile)%var_ix(iNC) + iVar = forcFileInfo(iFile)%var_ix(iNC) checkForce(iVar) = .true. if (.not.allocated(forcingDataStruct(iFile)%var(iVar)%dataFromFile))then allocate(forcingDataStruct(iFile)%var(iVar)%dataFromFile(numGRU,nTimeSteps)) @@ -129,19 +124,19 @@ subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, n ! Get Forcing Data ! get variable name for error reporting err=nf90_inquire_variable(ncid,iNC,name=varName) - if(err/=nf90_noerr)then; message=trim(message)//'problem reading forcing variable name from netCDF: '//trim(nf90_strerror(err)); return; endif + if(err/=nf90_noerr)then; message=trim(message)//'problem reading forcing variable name from netCDF: '//trim(nf90_strerror(err)); call f_c_string_ptr(message,message_r); return; endif ! define global HRU iHRU_global = gru_struc(1)%hruInfo(1)%hru_nc numHRU = sum(gru_struc(:)%hruCount) - err=nf90_get_var(ncid,forcFileInfo%ffile_list(iFile)%data_id(ivar),forcingDataStruct(iFile)%var(iVar)%dataFromFile, start=(/startGRU,1/),count=(/numHRU, nTimeSteps/)) - if(err/=nf90_noerr)then; message=trim(message)//'problem reading forcing data: '//trim(varName)//'/'//trim(nf90_strerror(err)); return; endif + err=nf90_get_var(ncid,forcFileInfo(iFile)%data_id(ivar),forcingDataStruct(iFile)%var(iVar)%dataFromFile, start=(/startGRU,1/),count=(/numHRU, nTimeSteps/)) + if(err/=nf90_noerr)then; message=trim(message)//'problem reading forcing data: '//trim(varName)//'/'//trim(nf90_strerror(err)); call f_c_string_ptr(message,message_r); return; endif end do call nc_file_close(ncid,err,message) - if(err/=0)then;message=trim(message)//trim(cmessage);return;end if + if(err/=0)then;message=trim(message)//trim(cmessage);call f_c_string_ptr(message,message_r);return;end if end subroutine read_forcingFile @@ -149,7 +144,7 @@ end subroutine read_forcingFile ! ************************************************************************* ! * open the NetCDF forcing file and get the time information ! ************************************************************************* -subroutine openForcingFile(forcFileInfo,iFile,infile,ncId,err,message) +subroutine openForcingFile(forc_file,iFile,infile,ncId,err,message) USE netcdf ! netcdf capability USE netcdf_util_module,only:nc_file_open ! open netcdf file USE time_utils_module,only:fracDay ! compute fractional day @@ -162,7 +157,7 @@ subroutine openForcingFile(forcFileInfo,iFile,infile,ncId,err,message) USE globalData,only:refJulDay_data USE summafilemanager,only:NC_TIME_ZONE ! dummy variables - type(file_info),intent(inout) :: forcFileInfo(:) + type(file_info),intent(inout) :: forc_file integer(i4b),intent(in) :: iFile ! index of current forcing file in forcing file list character(*) ,intent(in) :: infile ! input file integer(i4b) ,intent(out) :: ncId ! NetCDF ID @@ -214,16 +209,16 @@ subroutine openForcingFile(forcFileInfo,iFile,infile,ncId,err,message) ! get the time multiplier needed to convert time to units of days select case( trim( refTimeString(1:index(refTimeString,' ')) ) ) case('seconds') - forcFileInfo(iFile)%convTime2Days=86400._dp + forc_file%convTime2Days=86400._dp forcingDataStruct(iFile)%convTime2Days=86400._dp case('minutes') - forcFileInfo(iFile)%convTime2Days=1440._dp + forc_file%convTime2Days=1440._dp forcingDataStruct(iFile)%convTime2Days=1440._dp case('hours') - forcFileInfo(iFile)%convTime2Days=24._dp + forc_file%convTime2Days=24._dp forcingDataStruct(iFile)%convTime2Days=24._dp case('days') - forcFileInfo(iFile)%convTime2Days=1._dp + forc_file%convTime2Days=1._dp forcingDataStruct(iFile)%convTime2Days=1._dp case default; message=trim(message)//'unable to identify time units'; err=20; return end select diff --git a/build/source/hru_actor/hru_actor.cpp b/build/source/hru_actor/hru_actor.cpp index d4839ec8baf045d568760530d324ae74817196e4..e45dba9650c74454636726a7363396cabf6f318b 100644 --- a/build/source/hru_actor/hru_actor.cpp +++ b/build/source/hru_actor/hru_actor.cpp @@ -61,6 +61,10 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, break; } + if (hru_extra_logging) + aout(self) << "HRU:" << self->state.indxGRU << " - Timestep: " + << self->state.timestep << "\n"; + self->state.num_steps_until_write--; err = Run_HRU(self); // Simulate a Timestep if (err != 0) { @@ -96,10 +100,23 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, [=](new_forcing_file, int num_forcing_steps_in_iFile, int iFile) { + if (hru_extra_logging) { + aout(self) << "Recieved New iFile-" << iFile + << " with " << num_forcing_steps_in_iFile + << " forcing steps\n"; + } int err; self->state.iFile = iFile; self->state.stepsInCurrentFFile = num_forcing_steps_in_iFile; setTimeZoneOffset(&self->state.iFile, self->state.hru_data, &err); + if (err != 0) { + aout(self) << "Error: HRU_Actor - setTimeZoneOffset - HRU = " + << self->state.indxHRU << " - indxGRU = " + << self->state.indxGRU << " - refGRU = " + << self->state.refGRU << "\n"; + self->quit(); + return; + } self->state.forcingStep = 1; self->send(self, run_hru_v); }, diff --git a/build/source/summa_actor/fortran_global_state_actor.cpp b/build/source/summa_actor/fortran_global_state_actor.cpp index 0ad5b36869b4e8fc7a73276c9ed25f1a329911a0..aa8a72e7580bf2c147a3f7efc0bfc11ccfadaad8 100644 --- a/build/source/summa_actor/fortran_global_state_actor.cpp +++ b/build/source/summa_actor/fortran_global_state_actor.cpp @@ -1,42 +1,78 @@ #include "summa_actor.hpp" -namespace caf { - -// This actor's lifetime manages the global state of the fortran vars -// Set by the function summa_defineGlobalData() -behavior fortran_global_state_actor(event_based_actor* self) { - aout(self) << "Starting Global State Actor\n"; - self->attach_functor([=](const error& reason) { - aout(self) << "Global State Actor Exited\n"; +summaGlobalData::summaGlobalData() { + global_data_ready = false; +} + +summaGlobalData::~summaGlobalData() { + if (global_data_ready) { std::unique_ptr<char[]> err_msg(new char[1024]); int err = 0; deallocateGlobalData_fortran(&err, &err_msg); if (err != 0) { - aout(self) << "\n\nERROR: deallocateGlobalData_fortran() - " - << err_msg.get() << "\n\n"; + std::cout << "\n\nERROR: deallocateGlobalData_fortran() - " + << err_msg.get() << "\n\n"; } - }); - + } +} +int summaGlobalData::defineGlobalData() { std::unique_ptr<char[]> err_msg(new char[1024]); int err = 0; defineGlobalData_fortran(&err, &err_msg); if (err != 0) { - aout(self) << "\n\nERROR: defineGlobalData_fortran() - " - << err_msg.get() << "\n\n"; - self->quit(); - return {}; + std::cout << "\n\nERROR: defineGlobalData_fortran() - " + << err_msg.get() << "\n\n"; + global_data_ready = false; + } else { + global_data_ready = true; } + return err; +} - return { - // Needs a handler to persist, otherwise it gets cleaned up immediately - [=](int i) { - aout(self) << "Still Awake\n"; - } - }; -} + +// namespace caf { + +// // This actor's lifetime manages the global state of the fortran vars +// // Set by the function summa_defineGlobalData() +// behavior fortran_global_state_actor(event_based_actor* self, actor parent) { +// aout(self) << "Starting Global State Actor\n"; + +// self->attach_functor([=](const error& reason) { +// aout(self) << "Global State Actor Exited\n"; +// std::unique_ptr<char[]> err_msg(new char[1024]); +// int err = 0; +// deallocateGlobalData_fortran(&err, &err_msg); +// if (err != 0) { +// aout(self) << "\n\nERROR: deallocateGlobalData_fortran() - " +// << err_msg.get() << "\n\n"; +// } +// }); + + + + +// self->send(parent, global_data_ready_v); + +// return { +// // Needs a handler to persist, otherwise it gets cleaned up immediately +// [=](define_global_data) { +// std::unique_ptr<char[]> err_msg(new char[1024]); +// int err = 0; +// defineGlobalData_fortran(&err, &err_msg); +// if (err != 0) { +// aout(self) << "\n\nERROR: defineGlobalData_fortran() - " +// << err_msg.get() << "\n\n"; +// self->send(parent, err_v); +// self->quit(); +// return; +// } +// self->send(parent, global_data_ready_v); +// } +// }; +// } -} // namespace caf \ No newline at end of file +// } // namespace caf \ No newline at end of file diff --git a/build/source/summa_actor/summa_actor.cpp b/build/source/summa_actor/summa_actor.cpp index 62d2f83499057cf26953577b887f2c2d2ff04ee7..6e03fc6aef495ed56703e14ce0831d08a4200897 100644 --- a/build/source/summa_actor/summa_actor.cpp +++ b/build/source/summa_actor/summa_actor.cpp @@ -1,6 +1,5 @@ #include "caf/all.hpp" #include "caf/io/all.hpp" -#include "message_atoms.hpp" #include "summa_actor.hpp" #include "global.hpp" #include "job_actor.hpp" @@ -46,10 +45,14 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, self->quit(); return {}; } - // Start the Fortran State Actor for this node - self->state.fortran_state = - self->spawn(fortran_global_state_actor); - + // Create the global state + self->state.global_fortran_state = std::make_unique<summaGlobalData>(); + auto err = self->state.global_fortran_state->defineGlobalData(); + if (err != 0) { + aout(self) << "ERROR--Global State: Unable To Define Global Data\n"; + self->quit(); return {}; + } + self->state.fileGRU = getNumGRUInFile(file_manager->settings_path_, file_manager->local_attributes_); if (self->state.fileGRU == -1) @@ -74,13 +77,14 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, << "###################################################\n" << self->state.batch_container.getBatchesAsString() << "###################################################\n"; - std::optional<Batch> batch = self->state.batch_container.getUnsolvedBatch(); if (!batch.has_value()) { aout(self) << "ERROR--Summa_Actor: No Batches To Solve\n"; - self->quit(); return {}; + self->quit(); + return {}; } + self->state.current_batch_id = batch->getBatchID(); aout(self) << "Starting Batch " << self->state.current_batch_id + 1 << "\n"; auto batch_val = batch.value(); @@ -89,8 +93,6 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, self->state.job_actor_settings, self->state.hru_actor_settings, self); return { - - [=](done_job, int numFailed, double job_duration, double read_duration, double write_duration) { @@ -139,7 +141,7 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, } }, - [=](err) { + [=](err_atom) { aout(self) << "Unrecoverable Error: Attempting To Fail Gracefully\n"; self->quit(); } @@ -162,16 +164,6 @@ void spawnJob(stateful_actor<summa_actor_state>* self) { } // end namespace -// std::string extractEnclosed(const std::string& line) { -// std::size_t first_quote = line.find_first_of("'"); -// std::size_t last_quote = line.find_last_of("'"); -// if (first_quote != std::string::npos && last_quote != std::string::npos -// && first_quote < last_quote) { -// return line.substr(first_quote + 1, last_quote - first_quote - 1); -// } -// return ""; -// } - int getNumGRUInFile(const std::string &settingsPath, const std::string &attributeFile) { size_t fileGRU = -1;