summaryrefslogtreecommitdiff
path: root/ufo/ufo-resources.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-13 15:23:48 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-13 15:23:48 +0200
commit40388526cfac258e8633ad219f0a4ee88e0dcdd8 (patch)
treed4aa387e25da8cd510fcd893fa5f05a7f913c7d4 /ufo/ufo-resources.c
parente303911634c825925d76c5897cd73e5847e619c6 (diff)
Do not use GPUs if UFO_DEVICE_TYPE=cpu is set
Diffstat (limited to 'ufo/ufo-resources.c')
-rw-r--r--ufo/ufo-resources.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ufo/ufo-resources.c b/ufo/ufo-resources.c
index 7ca56cb..9023b05 100644
--- a/ufo/ufo-resources.c
+++ b/ufo/ufo-resources.c
@@ -385,7 +385,7 @@ get_device_type_from_env (void)
const gchar *var;
gchar **set;
guint n_set;
- cl_device_type type = 0;
+ cl_device_type type = CL_DEVICE_TYPE_DEFAULT;
var = g_getenv ("UFO_DEVICE_TYPE");
@@ -425,9 +425,16 @@ initialize_opencl (UfoResourcesPrivate *priv)
g_string_append (priv->build_opts, "-DVENDOR_AMD");
device_type = get_device_type_from_env ();
- device_type |= priv->device_type & UFO_DEVICE_CPU ? CL_DEVICE_TYPE_CPU : 0;
- device_type |= priv->device_type & UFO_DEVICE_GPU ? CL_DEVICE_TYPE_GPU : 0;
- device_type |= priv->device_type & UFO_DEVICE_ACC ? CL_DEVICE_TYPE_ACCELERATOR : 0;
+
+ if (device_type == CL_DEVICE_TYPE_DEFAULT) {
+ /*
+ * If the user did not set anything from the outside, check the
+ * device-type property.
+ */
+ device_type |= priv->device_type & UFO_DEVICE_CPU ? CL_DEVICE_TYPE_CPU : 0;
+ device_type |= priv->device_type & UFO_DEVICE_GPU ? CL_DEVICE_TYPE_GPU : 0;
+ device_type |= priv->device_type & UFO_DEVICE_ACC ? CL_DEVICE_TYPE_ACCELERATOR : 0;
+ }
g_debug ("INFO Using CPUs=%c GPUs=%c Accelerators=%c",
(device_type & CL_DEVICE_TYPE_CPU) != 0 ? 'y' : 'n',