From dfb15f6bbbe2264f8836c7cc9465784e3c3d1208 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 27 Jun 2017 15:51:48 +0000 Subject: [PATCH] Show value of GOMP_OPENACC_DIM in libgomp nvptx plugin 2017-06-27 Tom de Vries * plugin/plugin-nvptx.c (notify_var): New function. (nvptx_exec): Use notify_var for GOMP_OPENACC_DIM. From-SVN: r249695 --- libgomp/ChangeLog | 5 +++++ libgomp/plugin/plugin-nvptx.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 8a82d4f5aa6..0b5ee745dfb 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2017-06-27 Tom de Vries + + * plugin/plugin-nvptx.c (notify_var): New function. + (nvptx_exec): Use notify_var for GOMP_OPENACC_DIM. + 2017-06-27 Tom de Vries * env.c (parse_unsigned_long_1): Factor out of ... diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 0e1b3e2d4f3..71630b57355 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -867,6 +867,14 @@ nvptx_get_num_devices (void) return n; } +static void +notify_var (const char *var_name, const char *env_var) +{ + if (env_var == NULL) + GOMP_PLUGIN_debug (0, "%s: \n", var_name); + else + GOMP_PLUGIN_debug (0, "%s: '%s'\n", var_name, env_var); +} static bool link_ptx (CUmodule *module, const struct targ_ptx_obj *ptx_objs, @@ -1089,10 +1097,12 @@ nvptx_exec (void (*fn), size_t mapnum, void **hostaddrs, void **devaddrs, pthread_mutex_lock (&ptx_dev_lock); if (!default_dims[0]) { + const char *var_name = "GOMP_OPENACC_DIM"; /* We only read the environment variable once. You can't change it in the middle of execution. The syntax is the same as for the -fopenacc-dim compilation option. */ - const char *env_var = getenv ("GOMP_OPENACC_DIM"); + const char *env_var = getenv (var_name); + notify_var (var_name, env_var); if (env_var) { const char *pos = env_var; -- 2.30.2