![]() |
Table of Contents |
![]() |
6.5 Using switcherswitcher is a script that simplifies changes to a user's environment. It allows the user to make, with a single command, all the changes to paths and environmental variables needed to run an application. switcher is a script that uses the modules package. The modules package is an interesting package in its own right. It is a general utility that allows users to dynamically modify their environment using modulefiles. Each modulefile contains the information required to configure a shell for a specific application. A user can easily switch to another application, making required environmental changes with a single command. While it is not necessary to know anything about modules to use switcher, OSCAR installs the modules system and, it is available should you need or wish to use it. modules can be downloaded from http://modules.sourceforge.net/. switcher is designed so that changes take effect on future shells, not the current one. This was a conscious design decision. The disadvantage is that you will need to start a new shell to see the benefits of your change. On the positive side, you will not need to run switcher each time you log in. Nor will you need to edit your "dot" files such as .bashrc. You can make your changes once and forget about them. While switcher is currently used to change between the two MPI environments provided with OSCAR, it provides a general mechanism that can be used for other tasks. When experimenting with switcher, it is a good idea to create a new shell and test changes before closing the old shell. If you have problems, you can go back to the old shell and correct them. With switcher, tags are used to group similar software packages. For example, OSCAR uses the tag mpi for the included MPI systems. (You can list all available tags by invoking switcher with just the --list option.) You can easily list the attributes associated with a tag. [sloanjd@amy sloanjd]$ switcher mpi --list lam-7.0 lam-with-gm-7.0 mpich-ch_p4-gcc-1.2.5.10 In this example, we see the attributes are the two available MPI implementations. You use the --show option to use switcher to determine the default MPI environment. [sloanjd@amy sloanjd]$ switcher mpi --show system:default=lam-7.0 system:exists=true Alternately, you can use the which command: [sloanjd@amy sloanjd]$ which mpicc /opt/lam-7.0/bin/mpicc From the path, we can see that we are set up to use LAM/MPI rather than MPICH. To change the default to MPICH, simply assign the desired attribute value to the tag. [sloanjd@amy sloanjd]$ switcher mpi = mpich-ch_p4-gcc-1.2.5.10 Attribute successfully set; new attribute setting will be effective for future shells The change will not take effect immediately, but you will be using MPICH the next time you log in (and every time you log in until you run switcher again.) After the first time you make a change, switcher will ask you to confirm tag changes. (Also, the very first time you use switcher to change a tag, you'll receive a tag "does not exist" error message that can be safely ignored.) As root, you can change the default tag for everyone using the --system flag. [root@amy root]# switcher mpi = lam-7.0 --system One last word of warning! If you make a typo when entering the value for the attribute, switcher will not catch your mistake. |
![]() |
Table of Contents |
![]() |