From 0e234d34a18e4b2cf612df8329b3d2e4b3308c39 Mon Sep 17 00:00:00 2001 From: Derek Mendez Date: Fri, 2 Jun 2023 06:50:49 -0700 Subject: [PATCH] minor updates regarding kokkos * raise error if DIFFBRAGG_USE_CUDA and DIFFBRAGG_USE_KOKKOS are both defined * correctly print that kokkos was used (if diffBragg.verbose > 0) --- simtbx/diffBragg/__init__.py | 4 ++++ simtbx/diffBragg/src/diffBragg.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/simtbx/diffBragg/__init__.py b/simtbx/diffBragg/__init__.py index eabeeacac7..fc80bd9341 100644 --- a/simtbx/diffBragg/__init__.py +++ b/simtbx/diffBragg/__init__.py @@ -7,6 +7,10 @@ import numpy as np from simtbx_diffBragg_ext import * +import os +if os.environ.get("DIFFBRAGG_USE_CUDA") is not None and os.environ.get("DIFFBRAGG_USE_KOKKOS") is not None: + raise RuntimeError("Only set one of DIFFBRAGG_USE_CUDA, DIFFBRAGG_USE_KOKKOS.") + @bp.inject_into(ext.diffBragg) class _(): def get_derivative_pixels(self, refine_id): diff --git a/simtbx/diffBragg/src/diffBragg.cpp b/simtbx/diffBragg/src/diffBragg.cpp index c7b1e08bc3..b414651034 100644 --- a/simtbx/diffBragg/src/diffBragg.cpp +++ b/simtbx/diffBragg/src/diffBragg.cpp @@ -2114,6 +2114,8 @@ void diffBragg::add_diffBragg_spots(const af::shared& panels_fasts_slows printf("DIFFBRAGG isotropic Ncells=%d\n", isotropic_ncells); if(use_cuda || getenv("DIFFBRAGG_USE_CUDA")!= NULL) printf("TIME TO RUN DIFFBRAGG -GPU- (%llu iterations): %3.10f ms \n",n_total_iter, time); + else if(getenv("DIFFBRAGG_USE_KOKKOS")!= NULL) + printf("TIME TO RUN DIFFBRAGG -KOKKOS- (%llu iterations): %3.10f ms \n",n_total_iter, time); else printf("TIME TO RUN DIFFBRAGG -CPU- (%llu iterations): %3.10f ms \n",n_total_iter, time); }