diff --git a/bin/submission_one.sh b/bin/submission_one.sh new file mode 100755 index 0000000000000000000000000000000000000000..eaa562fc2522ec7e4c824e3833dc83a9fd0e9e20 --- /dev/null +++ b/bin/submission_one.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#SBATCH --cpus-per-task=1 +#SBATCH --time=01:00:00 +#SBATCH --mem=1G +#SBATCH --job-name=Summa-Actors +#SBATCH --mail-user=kyle.klenk@usask.ca +#SBATCH --mail-type=ALL +#SBATCH --output=/scratch/gwf/gwf_cmt/kck540/Summa-Actors/slurm/Summa-Actors%A.out +#SBATCH --account=hpc_c_giws_clark + +/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/bin/summaMain -g 1 -n 10 -c /project/gwf/gwf_cmt/kck540/domain_NorthAmerica/summa_actors_input/Summa_Actors_Settings.json + +/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/build/summa/bin/summa.exe -g 1 10 -m /project/gwf/gwf_cmt/kck540/domain_NorthAmerica/summa_actors_input/fileManager.txt \ No newline at end of file diff --git a/build/includes/file_access_actor/output_container.hpp b/build/includes/file_access_actor/output_container.hpp index d5fdb89ad78f025b7474fe36b554512642b03efb..568a760d9ac1fb081142fdefc75903ebc5184839 100644 --- a/build/includes/file_access_actor/output_container.hpp +++ b/build/includes/file_access_actor/output_container.hpp @@ -38,7 +38,6 @@ struct hru_output_handles { void* handle_output_timestep = new_handle_var_i(); ~hru_output_handles() { - std::cout << "Destructor called" << std::endl; // statistics structures delete_handle_var_dlength(handle_forc_stat); delete_handle_var_dlength(handle_prog_stat); diff --git a/build/makefiles/compile_copernicus.sh b/build/makefiles/compile_copernicus.sh new file mode 100644 index 0000000000000000000000000000000000000000..defa4b69d3bacfeede63c94e26cd2b673c3d5cc2 --- /dev/null +++ b/build/makefiles/compile_copernicus.sh @@ -0,0 +1,30 @@ +#! /bin/bash + +#### load modules if using Compute Canada or Copernicus #### +module load gcc/9.3.0 +module load netcdf-fortran +module load openblas +module load caf + + +#### parent directory of the 'build' directory #### +export ROOT_DIR=/globalhome/kck540/HPC/Summa-Projects/Summa-Actors + +export INCLUDES="-I$EBROOTNETCDFMINFORTRAN/include" +export LIBRARIES="-L$EBROOTNETCDFMINFORTRAN/lib64\ + -L$EBROOTOPENBLAS/lib\ + -lnetcdff -lopenblas" + +# INCLUDES FOR Actors Component +export ACTORS_INCLUDES="-I$EBROOTCAF/include\ + -I$EBROOTNETCDFMINFORTRAN/include" + +export ACTORS_LIBRARIES="-L$EBROOTCAF/lib\ + -L$EBROOTCAF/lib64\ + -L$EBROOTNETCDFMINFORTRAN/lib64\ + -L$EBROOTOPENBLAS/lib\ + -L$ROOT_DIR/bin\ + -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff" + +make -f ${ROOT_DIR}/build/makefiles/makefile_cluster +export LD_LIBRARY_PATH=${ROOT_DIR}/bin \ No newline at end of file diff --git a/build/makefiles/makefile_cluster b/build/makefiles/makefile_cluster index 8f18e3b129e2b91247421e810147996bb8549923..3dcc6ad8798292a73f88fc14ec29e1f62d046805 100644 --- a/build/makefiles/makefile_cluster +++ b/build/makefiles/makefile_cluster @@ -1,5 +1,5 @@ #### parent directory of the 'build' directory #### -ROOT_DIR = /home/kklenk/Summa-Projects/Summa-Actors +ROOT_DIR = /globalhome/kck540/HPC/Summa-Projects/Summa-Actors #### Compilers #### FC = gfortran # Fortran @@ -26,7 +26,6 @@ FLAGS_ACTORS = -O3 -Wfatal-errors -std=c++17 # FLAGS_ACTORS = -g -O0 -Wall -std=c++17 - #======================================================================== # PART 1: Define directory paths #======================================================================== @@ -296,9 +295,6 @@ BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp -CLIENT_BATCH = $(SOURCE_DIR)/summa_actor/batch_client.cpp -CLIENT_BATCH_CONTAINERS = $(SOURCE_DIR)/summa_actor/batch_client_containers.cpp - GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp @@ -309,7 +305,7 @@ GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp -OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_manager.cpp +OUTPUT_CONTAINER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_container.cpp HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp @@ -364,7 +360,7 @@ clean_fortran: ################################################################################################################### ################################################ COMPILE SUMMA-C++ ################################################ ################################################################################################################### -compile_globals: +compile_globals: $(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) compile_gru_actor: @@ -374,7 +370,7 @@ compile_hru_actor: $(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) compile_file_access_actor: - $(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \ + $(CC) $(FLAGS_ACTORS) -c $(OUTPUT_CONTAINER) $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) \ $(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) compile_job_actor: @@ -396,7 +392,7 @@ compile_main: $(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES) link_cpp: - $(CC) $(FLAGS_ACTORS) -Wl,-rpath='/Summa-Actors/bin:/usr/local/lib' -o summaMain *.o $(ACTORS_LIBRARIES) + $(CC) $(FLAGS_ACTORS) -Wl,-rpath='/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/bin' -o summaMain *.o $(ACTORS_LIBRARIES) mv summaMain $(ROOT_DIR)/bin clean_cpp: diff --git a/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp b/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp index 0a867d30604ea0ffd3c1c9446855e504eaa7731e..71059a7547b9e12e34483c638f53537b302e6697 100644 --- a/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp +++ b/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp @@ -110,7 +110,7 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr currentFile); } } else { - aout(self) << currentFile << " is larger than expected" << std::endl; + aout(self) << currentFile << " is larger than expected for a forcing file request from an HRU" << std::endl; } }, @@ -178,7 +178,6 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr self->state.file_access_timing.updateStartPoint("write_duration"); - aout(self) << "Called\n"; std::shared_ptr<hru_output_handles> hru_output = std::make_shared<hru_output_handles>(); @@ -216,9 +215,39 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr if (partition_index.has_value()) { // We have a partition to write std::vector<std::vector<std::shared_ptr<hru_output_handles>>> hru_output_from_vector = getOutputHandlesFromPartition(partition_index.value(), self->state.output_partitions); - for (int hru = 0; hru < hru_output_from_vector.size(); hru++) { - for (int timestep = 0; timestep < hru_output_from_vector[hru].size(); timestep++) { - writeBasinToNetCDF(self->state.handle_ncid, &index_gru, + for (int hru = 0; hru < self->state.output_partitions[partition_index.value()]->hru_info_and_data.size(); hru++) { + for(int timestep = 0; timestep < self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data.size(); timestep++) { + // writeBasinToNetCDF(self->state.handle_ncid, &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_gru, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_finalize_stats, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_output_timestep, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_bvar_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_bvar_struct, &err); + + // writeTimeToNetCDF(self->state.handle_ncid, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_finalize_stats, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_output_timestep, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_time_struct, &err); + + // writeDataToNetCDF(self->state.handle_ncid, &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_gru, + // &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_hru, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_finalize_stats, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_forc_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_forc_struct, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_prog_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_prog_struct, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_diag_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_diag_struct, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_flux_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_flux_struct, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_indx_stat, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_indx_struct, + // self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->output_data[timestep]->handle_output_timestep, + // &err); + // } + + // for (int hru = 0; hru < hru_output_from_vector.size(); hru++) { + // for (int timestep = 0; timestep < hru_output_from_vector[hru].size(); timestep++) { + writeBasinToNetCDF(self->state.handle_ncid, &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_gru, hru_output_from_vector[hru][timestep]->handle_finalize_stats, hru_output_from_vector[hru][timestep]->handle_output_timestep, hru_output_from_vector[hru][timestep]->handle_bvar_stat, @@ -229,7 +258,8 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr hru_output_from_vector[hru][timestep]->handle_output_timestep, hru_output_from_vector[hru][timestep]->handle_time_struct, &err); - writeDataToNetCDF(self->state.handle_ncid, &index_gru, &index_hru, + writeDataToNetCDF(self->state.handle_ncid, &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_gru, + &self->state.output_partitions[partition_index.value()]->hru_info_and_data[hru]->index_hru, hru_output_from_vector[hru][timestep]->handle_finalize_stats, hru_output_from_vector[hru][timestep]->handle_forc_stat, hru_output_from_vector[hru][timestep]->handle_forc_struct, @@ -243,8 +273,40 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr hru_output_from_vector[hru][timestep]->handle_indx_struct, hru_output_from_vector[hru][timestep]->handle_output_timestep, &err); + // } } } + + + // for (int hru = 0; hru < hru_output_from_vector.size(); hru++) { + // for (int timestep = 0; timestep < hru_output_from_vector[hru].size(); timestep++) { + // writeBasinToNetCDF(self->state.handle_ncid, &index_gru, + // hru_output_from_vector[hru][timestep]->handle_finalize_stats, + // hru_output_from_vector[hru][timestep]->handle_output_timestep, + // hru_output_from_vector[hru][timestep]->handle_bvar_stat, + // hru_output_from_vector[hru][timestep]->handle_bvar_struct, &err); + + // writeTimeToNetCDF(self->state.handle_ncid, + // hru_output_from_vector[hru][timestep]->handle_finalize_stats, + // hru_output_from_vector[hru][timestep]->handle_output_timestep, + // hru_output_from_vector[hru][timestep]->handle_time_struct, &err); + + // writeDataToNetCDF(self->state.handle_ncid, &index_gru, &index_hru, + // hru_output_from_vector[hru][timestep]->handle_finalize_stats, + // hru_output_from_vector[hru][timestep]->handle_forc_stat, + // hru_output_from_vector[hru][timestep]->handle_forc_struct, + // hru_output_from_vector[hru][timestep]->handle_prog_stat, + // hru_output_from_vector[hru][timestep]->handle_prog_struct, + // hru_output_from_vector[hru][timestep]->handle_diag_stat, + // hru_output_from_vector[hru][timestep]->handle_diag_struct, + // hru_output_from_vector[hru][timestep]->handle_flux_stat, + // hru_output_from_vector[hru][timestep]->handle_flux_struct, + // hru_output_from_vector[hru][timestep]->handle_indx_stat, + // hru_output_from_vector[hru][timestep]->handle_indx_struct, + // hru_output_from_vector[hru][timestep]->handle_output_timestep, + // &err); + // } + // } clearOutputPartition(self->state.output_partitions[partition_index.value()]); updateSimulationTimestepsRemaining(self->state.output_partitions[partition_index.value()]); diff --git a/build/source/actors/file_access_actor/cpp_code/output_container.cpp b/build/source/actors/file_access_actor/cpp_code/output_container.cpp index fcd09e4f471d781f4d8f71e946720737e020397a..790a648211d1b984360e5e3caa515a7e761d03aa 100644 --- a/build/source/actors/file_access_actor/cpp_code/output_container.cpp +++ b/build/source/actors/file_access_actor/cpp_code/output_container.cpp @@ -84,6 +84,7 @@ bool isPartitionFull(std::shared_ptr<output_partition> &output_partition) { std::vector<std::vector<std::shared_ptr<hru_output_handles>>> getOutputHandlesFromPartition(int partition_index, std::vector<std::shared_ptr<output_partition>>& output_partitions) { std::vector<std::vector<std::shared_ptr<hru_output_handles>>> output_handles; + std::cout << "numGRUs = " << output_partitions[partition_index]->hru_info_and_data.size() << std::endl; for (auto &hru_info_and_data : output_partitions[partition_index]->hru_info_and_data) { output_handles.push_back(hru_info_and_data->output_data); } diff --git a/build/source/actors/hru_actor/cpp_code/hru_actor.cpp b/build/source/actors/hru_actor/cpp_code/hru_actor.cpp index 098fbb43224af6ae33b74a1a8cb3a5e0f6afa302..4fa9f0c4bb73fe3f10acae4c79884f16764d77e1 100644 --- a/build/source/actors/hru_actor/cpp_code/hru_actor.cpp +++ b/build/source/actors/hru_actor/cpp_code/hru_actor.cpp @@ -52,7 +52,6 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, self->quit(); } - aout(self) << "NumSteps = " << self->state.num_steps << std::endl; self->send(self->state.file_access_actor, get_num_output_steps_v, self); @@ -108,7 +107,6 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, }, [=](num_steps_before_write, int num_steps) { - aout(self) << "NumSteps = " << num_steps << std::endl; self->state.num_steps_until_write = num_steps; }, diff --git a/build/summa b/build/summa new file mode 160000 index 0000000000000000000000000000000000000000..fa9adf808229a45085defdc2bb8ef05836b9b3aa --- /dev/null +++ b/build/summa @@ -0,0 +1 @@ +Subproject commit fa9adf808229a45085defdc2bb8ef05836b9b3aa diff --git a/laugh_tests b/laugh_tests new file mode 160000 index 0000000000000000000000000000000000000000..a1dfea1dfbcd128b6ee666cbe0ddbc2785b43fb4 --- /dev/null +++ b/laugh_tests @@ -0,0 +1 @@ +Subproject commit a1dfea1dfbcd128b6ee666cbe0ddbc2785b43fb4