新浪博客

moduleload/unload命令(Envrionmentmodules工具)

2019-04-04 20:03阅读:
Envrionment modules工具用来快速的设置和修改用户编译运行环境。
Envrionment modules通过加载和卸载modulefile文件可直接改变用户的环境变量,用户不需要修改.bashrc,从而避免误操作。
使用module来管理编译器,库函数的版本,常用命令如下:
1. module load | add 加载环境变量
如,在linux上分别加载 VCS和Verdi环境变量
% module load vcs/2015.09 # (加载VCS)
% which vcs # (查看是否加载成功)
结果 /tool/cbar/apps/vcs-mx/2015.09-SP2-T0315/bin/vcs
% module load verdi/2014.12 # (加载Verdi)
% which verdi
# (查看是否加载成功)
结果 /tool/cbar/apps/verdi/2014.03/bin/verdi
2. module switch 改变环境变量的版本号
如果想切换已加载模块的版本,使用module switch 命令
% module load vcs/2012.09 # (加载VCS)
% which vcs # (查看版本号是否改变成功)
结果 /tool/cbar/apps/vcs-mx/2012.09-SP2-T0315/bin/vcs
3.1 module unload | rm 卸载环境变量
3.2 module swap 替换环境变量
有时modules会有版本冲突,比如,在已经加载vcs版本的情况下,试图加载另一个版本2015.09,而已加载的版本为2012.09,此时会报错。如果想使用最新的编译器,应该使用如命令
% module unload vcs
% module load vcs/2015.09
或者更快捷的方式
% module swap vcs vcs/2015.09
4. module avail -- 显示系统可用的编译器及库
5. module list 显示用户加载的编译器及库
6. module help 帮助命令
=======================链接=======================================
http://blog.sina.cn/dpool/blog/s/blog_61fdeeea010135um.html?vt=4
http://wenku.baidu.com/link?url=1qzAqGosG4lDlqXtXRgnfWpJF44dYgq_lVJGwNYoVkeN_FpYTMXZHt1oxa9JUlLfNTZQ-4bEYnb3EW4Ki0pitX_QlUIroecVSUhYig6FnOi
Environment modules工具使用说明_百度文库
==============================================================
The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles.
Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles.
Modules can be loaded and unloaded dynamically and atomically, in an clean fashion. All popular shells are supported, including bash, ksh, zsh, sh, csh, tcsh, as well as some scripting languages such as perl and python.
Modules are useful in managing different versions of applications. Modules can also be bundled into metamodules that will load an entire suite of different applications.


There are two versions of the Environment Modules package. An experimental version is written in Tcl. The stable traditional version is written in C. Both versions use the same modulefiles and command line syntax, with the exception that the Tcl version can use an abbreviated version of the 'switch' command.
Tcl Version (beta). You must have tclsh somewhere in your default $PATH, version 8.0 or newer; in addition, you must install the files in the init directory someplace that all of your users/systems can access (i.e., there is no automated install for the Tcl version as yet).
http://modules.cvs.sourceforge.net/viewvc/modules/modules/tcl/
C version (released versions). This version requires compilation and linking with the libtcl*.a libraries. The first link is the main site; the others are mirrors.
http://sourceforge.net/project/showfiles.php?group_id=15538

我的更多文章

下载客户端阅读体验更佳

APP专享