Skip to content

Commit

Permalink
When doing --skip_align maintain GPU flag settings for Blush regulari…
Browse files Browse the repository at this point in the history
…zation.
  • Loading branch information
dkimanius committed May 29, 2024
1 parent 850e945 commit c818a03
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions src/ml_optimiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,9 +2024,32 @@ void MlOptimiser::initialiseGeneral(int rank)
if (!exists(fn_dir))
REPORT_ERROR("ERROR: output directory does not exist!");

// Just die if trying to use accelerators and skipping alignments
if ((do_skip_align || do_skip_rotate) && (do_gpu || do_sycl || do_cpu))
REPORT_ERROR("ERROR: you cannot use accelerators when skipping alignments.");
char *env_blush_args = getenv("RELION_BLUSH_ARGS");
if (env_blush_args != nullptr)
blush_args += std::string(env_blush_args);

if (skip_spectral_trailing)
blush_args += " --skip-spectral-trailing ";

if (do_gpu)
{
blush_args += " --gpu ";
for (auto &d : gpuDevices)
blush_args += gpu_ids + ",";
blush_args += " ";
}
else
blush_args = blush_args + " --gpu -1 ";

if (do_skip_align || do_skip_rotate)
{
do_gpu = false;
do_sycl = false;
do_cpu = false;

std::cerr << "WARNING: you cannot use accelerators (like the GPU) when skipping alignments." << std::endl
<< "Will continue without accelerators and maintain setting for external tasks (like Blush regularization)." << std::endl;
}

if (do_always_cc)
do_calculate_initial_sigma_noise = false;
Expand Down Expand Up @@ -2532,23 +2555,6 @@ void MlOptimiser::initialiseGeneral(int rank)
mu = 0.;
}

char *env_blush_args = getenv("RELION_BLUSH_ARGS");
if (env_blush_args != nullptr)
blush_args += std::string(env_blush_args);

if (skip_spectral_trailing)
blush_args += " --skip-spectral-trailing ";

if (do_gpu)
{
blush_args += " --gpu ";
for (auto &d: gpuDevices)
blush_args += gpu_ids + ",";
blush_args += " ";
}
else
blush_args = blush_args + " --gpu -1 ";

if (minimum_nr_particles_sigma2_noise < 0)
{
minimum_nr_particles_sigma2_noise = (mymodel.data_dim == 3 || mydata.is_tomo) ? 10 : 1000;
Expand Down

0 comments on commit c818a03

Please sign in to comment.