From 55e7e718cacf8bd17e2a8f306558a0a6a35eb1bf Mon Sep 17 00:00:00 2001 From: Marcin Kirsz <mkirsz@ed.ac.uk> Date: Fri, 4 Oct 2024 15:16:17 +0100 Subject: [PATCH] Better handling of -u flag with MPI build --- bin/tadah_cli.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/tadah_cli.cpp b/bin/tadah_cli.cpp index 8441e1b..67f57aa 100644 --- a/bin/tadah_cli.cpp +++ b/bin/tadah_cli.cpp @@ -33,6 +33,14 @@ void TadahCLI::subcommand_train() { std::cout << "Minimum number of cpus for an mpi version is 2" << std::endl; return; } + if (train->count("--uncertainty")) { + if (rank==0) { + std::cout << "-----------------------------------------------------" << std::endl; + std::cout << "The --uncertainty flag is not supported by MPI build." << std::endl; + std::cout << "-----------------------------------------------" << std::endl; + } + return; + } #endif CLI::Timer timer_tot {"Training", CLI::Timer::Big}; @@ -326,21 +334,16 @@ void TadahCLI::subcommand_train() { std::ofstream outfile; outfile.open ("pot.tadah"); outfile << param_file << std::endl;; - // TODO What about uncertainty when MPI is enabled? +#ifndef TADAH_BUILD_MPI if(train->count("--uncertainty")) { -#ifdef TADAH_BUILD_MPI - throw std::runtime_error("--uncertainty flag is not supported by Tadah! MPI build"); -#else t_type weights = model->get_weights(); t_type unc = model->get_weights_uncertainty(); Output(param_file,false).print_train_unc(weights, unc); -#endif } +#endif - if (is_verbose()) std::cout << timer_tot.to_string() << std::endl; - // } } @@ -397,8 +400,6 @@ void TadahCLI::subcommand_predict() { DescriptorsCalc<> dc(pot_config,*DCS.d2b,*DCS.d3b,*DCS.dmb, *DCS.c2b,*DCS.c3b,*DCS.cmb); - - if (is_verbose()) std::cout << "Prediction start..." << std::flush; DM_Function_Base *fb = CONFIG::factory<DM_Function_Base,Config&>( pot_config.get<std::string>("MODEL",1),pot_config); -- GitLab