PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

conditionally include localrc

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation
View previous topic :: View next topic  
Author Message
EC-HPCS



Joined: 27 May 2011
Posts: 6

PostPosted: Mon Oct 01, 2012 12:38 pm    Post subject: conditionally include localrc Reply with quote

Is it possible to conditionally include a localrc-type file based on an environment variable setting? In code, I would like to do something like:

-----
variable X is environment (X);
cinclude localrc.$X;
-----

Also, is there any publicly available reference for the language used in the *rc files?

Thanks,
John
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6120
Location: The Portland Group Inc.

PostPosted: Tue Oct 02, 2012 10:21 am    Post subject: Reply with quote

Hi John,

I sent your question to engineering and got the following response:

Quote:
The 'include' processing is done before the driver variables are
expanded, so, no, there's no way to generate the name of a file to
include in the driver at this time. We do use the special syntax '$$'
which gets expanded to the hostname of the system on which the driver is
being run, so you can see 'cinclude localrc.$$;' in some places. You
can also add relative paths, like 'cinclude ../something/myrcfile;'

We've never run into the case where we needed to generate the rcfile
name; the difficulties come because the driver variable values aren't
finalized until after ALL the command line flags are parsed, but the
command line flags are defined in the rcfiles, and if the rcfile names
are defined by driver variable values, we have a circular dependence.
The case the user asks for, where the value of the variable is defined
by an environment variable, could perhaps be handled, though we've not
had a need for it as yet.


Is the ".$$" syntax sufficient for what you need or would you like me to add a feature request?

Quote:
Also, is there any publicly available reference for the language used in the *rc files?
I can send you some basic documentation. It's more meant for PGI internal use but we don't mind sending to customers who request it.

- Mat
Back to top
View user's profile
EC-HPCS



Joined: 27 May 2011
Posts: 6

PostPosted: Tue Oct 02, 2012 10:46 am    Post subject: Reply with quote

Quote:
Hi John,

I sent your question to engineering and got the following response:

Quote:
The 'include' processing is done before the driver variables are
expanded, so, no, there's no way to generate the name of a file to
include in the driver at this time. We do use the special syntax '$$'
which gets expanded to the hostname of the system on which the driver is
being run, so you can see 'cinclude localrc.$$;' in some places. You
can also add relative paths, like 'cinclude ../something/myrcfile;'

We've never run into the case where we needed to generate the rcfile
name; the difficulties come because the driver variable values aren't
finalized until after ALL the command line flags are parsed, but the
command line flags are defined in the rcfiles, and if the rcfile names
are defined by driver variable values, we have a circular dependence.
The case the user asks for, where the value of the variable is defined
by an environment variable, could perhaps be handled, though we've not
had a need for it as yet.


Is the ".$$" syntax sufficient for what you need or would you like me to add a feature request?


Mat,

I saw the "magic" $$ which stands in for a hostname and was hoping that there was some other, more general, mechanism.

Another option was along the lines of:
http://www.pgroup.com/userforum/viewtopic.php?t=120&start=0&postdays=0&postorder=asc&highlight=language+localrc

but that would be very cumbersome and I could not figure out how the $if() might be used for a slew of "set ..." lines.

I understand the sequence you describe which makes this not work. Rather than a completely general solution, might it be possible/worthwhile to support an alternate "magic" value (along the lines of $$) which would be controllable/settable outside of the rc-file? It would give runtime flexibility that is not host dependent. Or, perhaps $$ itself could map to a PGI env variable and if non-existent would default to the hostname.

Quote:

Quote:
Also, is there any publicly available reference for the language used in the *rc files?
I can send you some basic documentation. It's more meant for PGI internal use but we don't mind sending to customers who request it.


Yes. That would be helpful. (Note: I have received it).

Thanks,
John
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group