conditionally include localrc

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

Hi John,

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

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?

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

Hi John,

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

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.

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