Thanks to all who responded! This is great information.
-----Original Message-----
From: Ted Stern [mailto:dodecatheon@...]
Sent: Wednesday, January 26, 2011 1:42 PM
To: modules-interest@...
Subject: Re: [Modules] Can you pass arguments to modulefiles?
On 26 Jan 2011 07:30:02 -0800, Thomas Borneman wrote:
>
> We load some specific libraries for compilers and the libraries are
> separated depending if it's a single cpu or a smp system.
>
> I suppose I could parse the "machine" uname variable to see if smp is
> connected to the kernel version.
>
I have similar sorts of compiler + mpi library problem with my setup.
I have a .version file that handles environment variables. A previous
poster mentioned how you might use them to select a module.
You may find this syntax useful. Caution, I use very long module
names.
#%Module1.0#################### -*- mode:tcl -*-
##############################
#
# version file for /opt/sw/mytools/<config_type>/modulefiles/thistool/
#
set default_vendor 1.2.3
set default_builder admin
set default_local mygroup.4.5.6
set default_prec dp
set default_parallel mpi
set default_compiler pgi90
set default_mpilib mpichgm127
set default_config something
set default_version
$default_vendor-$default_builder-$default_local-$default_prec-$default_p
arallel-$default_compiler-$default_mpilib-$default_config
catch {set vendor_version $env(THISTOOL_VENDOR_VERSION)}
if {![info exists vendor_version]} {
set vendor_version $default_vendor
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_VENDOR_VERSION env variable changed
default vendor_version from $default_vendor to $vendor_version"
}
catch {set builder $env(THISTOOL_BUILDER)}
if {![info exists builder]} {
set builder $default_builder
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_BUILDER env variable changed default
builder from $default_builder to $builder"
}
catch {set local_version $env(THISTOOL_LOCAL_VERSION)}
if {![info exists local_version]} {
set local_version $default_local
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_LOCAL_VERSION env variable changed
default local_version from $default_local to $local_version"
}
catch {set precision $env(THISTOOL_PRECISION)}
if {![info exists precision]} {
set precision $default_prec
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_PRECISION env variable changed
default precision from $default_prec to $precision"
}
catch {set parallel $env(THISTOOL_PARALLEL)}
if {![info exists parallel]} {
set parallel $default_parallel
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_PARALLEL env variable changed
default parallel from $default_parallel to $parallel"
}
catch {set compiler $env(THISTOOL_COMPILER)}
if {![info exists compiler]} {
set compiler $default_compiler
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_COMPILER env variable changed
default compiler from $default_compiler to $compiler"
}
catch {set mpilib $env(THISTOOL_MPILIB)}
if {![info exists mpilib]} {
set mpilib $default_mpilib
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_MPILIB env variable changed default
mpilib from $default_mpilib to $mpilib"
}
catch {set config $env(THISTOOL_CONFIG)}
if {![info exists config]} {
set config $default_config
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_CONFIG env variable changed default
config from $default_config to $config"
}
catch {set version $env(THISTOOL_VERSION)}
if {![info exists version]} {
set version
$vendor_version-$builder-$local_version-$precision-$parallel-$compiler-$
mpilib-$config
} elseif {![module-info mode remove]} {
puts stderr "thistool: THISTOOL_VERSION env variable changed default
version from $default_version to $version"
}
set ModulesVersion $version
unset default_vendor
unset default_builder
unset default_local
unset default_prec
unset default_parallel
unset default_compiler
unset default_mpilib
unset default_config
unset default_version
unset vendor_version
unset builder
unset local_version
unset precision
unset parallel
unset compiler
unset mpilib
unset config
unset version
> ---
> Thomas W. Borneman
> SGI - Engineering SysAdmin
> Phone: 715-726-8414
> Fax: 715-726-4345
> Cell: 715-559-8414
> Email: borno@...
>
>> -----Original Message-----
>> From: Peter Kruse [mailto:pjodrr@...]
>> Sent: Wednesday, January 26, 2011 2:29 AM
>> To: Environment Modules usage and discussion.
>> Subject: Re: [Modules] Can you pass arguments to modulefiles?
>>
>> Hi,
>>
>> On Tue, Jan 25, 2011 at 10:28 PM, Thomas Borneman <borno@...>
> wrote:
>> > Can you pass arguments to modulefiles when loading modulesfiles via
> the
>> > module command?
>> >
>> > Example:
>> >
>> > module load <modulefile> <argument to modulefile>
>> >
>> > If so, how is coded in the modulefile?
>>
>> I don't think that this is possible since the arguments <modulefile>
> and
>> <argument to modulefile> are in fact arguments to the "load"
> sub-command
>> and both are interpreted as files to load. What are you trying to
>> achieve,
>> maybe there is another solution to your problem.
>>
>> Peter
>>
>>
>
------------------------------------------------------------------------
> --
>> ----
>> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
>> Finally, a world-class log management solution at an even better
> price-
>> free!
>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
>> February 28th, so secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsight-sfd2d
>> _______________________________________________
>> Modules-interest mailing list
>> Modules-interest@...
>> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
>
------------------------------------------------------------------------
------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Modules-interest mailing list
> Modules-interest@...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
--
Frango ut patefaciam -- I break so that I may reveal
------------------------------------------------------------------------
------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better
price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Modules-interest mailing list
Modules-interest@...
https://lists.sourceforge.net/lists/listinfo/modules-interest
|