From: James Dinan (dinan_at_cse.ohio-state.edu)
Date: Sun Apr 26 2009 - 12:55:00 PDT
Hi, I've run into a slight problem with how the environment is propagated when using the UDP conduit. I'm using BUPC 2.8.0. My code is calling a non-upc library function which queries an environment variable. The environment variable can be read fine in main but not in the non-upc library I am calling. Looking through the translated code I realized this is because the upc compiler is substituting bupc_getenv for calls to getenv. BUPC is then reading the correct value from its private copy of the environment. Unfortunately I can't do this substitution in the library code. One workaround is to call bupc_getenv() followed by setenv in my UPC code to manually copy the variable from one environment to the other. But this is not ideal. Is there a better way to ensure that BUPC propagates values from its environment into the main environment? I tried setting UPC_ENVPREFIX but that didn't help. Also, I noticed this problem does not occur when using the mpi conduit so it may be restricted to environment handling for the udp conduit. I've attached a test case that exercises my problem. Here is what the output looks like on my system: ---snip--- $ make gcc -Wall -c -o library.o library.c upcc -network=udp -o env-test library.o env-test.upc $ export MYVAR=success $ upcrun -n 1 ./env-test UPCR: UPC thread 0 of 1 on bblogin (process 0 of 1, pid=23587) Environment lookup test. Variable name is MYVAR. main: success env_test: (null) Manually propagating variable from upc main main: success env_test: success ---snip--- Also, a big thanks to all who have contributed to Berkeley UPC. This is a wonderful project! Best wishes, ~Jim.