LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-13-2009, 08:20 AM   #1
jovana.knezevic.83
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Rep: Reputation: 0
script executing-problem ("module: command not found")


Hello everyone.
I'm trying to execute a script on a cluster (connected via ssh), because I have to load gcc and mpich2 to all the machines before I execute my parallel program on them (it is shared memory), so, to cut the long story short, my script looks like:

#!/bin/bash

module load gcc
module unload mpi.parastation
module load mpi.mpich2/1.0.5

however, on the execution it prints the message:
module: command not found

If I try to execute something "stupid" in the same script, like:
echo "blah blah",
it does print blah blah indeed!

Does anyone have a clue what the problem might be? Some prefixes to module-command? Thanks in advance.
 
Old 10-13-2009, 11:03 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,541
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Is the module command installed on the remote system? If so then it is not in the directories listed in $PATH and you can either modify $PATH to include the directory containing the module executable or you can give the full path to the module executable instead of its name alone.
 
Old 10-13-2009, 11:04 AM   #3
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
I think this will help (from https://subtrac.sara.nl/userdoc/wiki/shared/modules):

Quote:
Modules and shells

The module command is shell-independent, but the implementation is shell-dependent:

* bash: module is an exported shell function
* csh/tcsh: module is an alias
* ksh: module is a shell function

Th system-wide initialization scripts take care that the module environment is properly initiated at the start of a job or interactive session, using the method for your login shell. Problems arise when:

* the shell that is used in a job is not the login shell
* a subshell is created to the same shell (only for non-bash shells)
* a subshell is created to another shell

In these cases, it is necessary to define the modules environment :

* bash:
. /usr/share/modules/init/bash
* csh/tcsh:
source /usr/share/modules/init/csh
* ksh:
. /usr/share/modules/init/ksh

We recommend to use bash as login shell and as shell in jobs.
Dobrodosla na linuxquestions.org forume
 
Old 10-14-2009, 03:22 AM   #4
jovana.knezevic.83
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks both of you!

@catkin:

The thing is that when I run these "module load" commands from the console, it works, so yes, it should be installed on the machines.
When I type:
whereis -b module, it prints just
module:

Isn't this strange? How can I now the path to the module executable? am I doing something wrong? :)

@DrLove73:

(Hvala, hvala :))
"In these cases, it is necessary to define the modules environment :

* bash:
. /usr/share/modules/init/bash
* csh/tcsh:
source /usr/share/modules/init/csh
* ksh:
. /usr/share/modules/init/ksh"

What does this exactly mean? I'm not very selfconfident at the moment :)
 
Old 10-14-2009, 04:29 AM   #5
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
I never needed modules so my knowledge is very very limited I just used intelligent google searching for above.

I also found this tutorial :http://modules.sourceforge.net/docs/...tney_paper.pdf

and http://www-theor.ch.cam.ac.uk/IT/software/modules.html

but this should be more helpful:http://www.uni-koeln.de/rrzk/server/...n/modules.html :
Quote:
Modules in Batch-Scripts
Before loading modules in batch scripts, the module-environment has to be set up by sourcing files that include the module-environment into the shell. These files are:

* /etc/profile.d/modules.sh
for the shells bash and sh and similar ones and
* /etc/profile.d/modules.csh
for csh and tcsh .

For running software available as module, the module has to be loaded in the batch-script. For running software compiled with library-modules in batch scripts, again first load the compiler module that was used on compilation, then load the library.
 
Old 10-14-2009, 08:25 AM   #6
jovana.knezevic.83
LQ Newbie
 
Registered: Oct 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Yeap, thanks a lot!!! :)

Sourcing /etc/profile.d/modules.sh in the script solved the problem
"module : command not found"
So it seems to load gcc & mpich on "my" machines.

However, I don't see that I have achieved anything with this, since it gives Segmentation fault immediately and I don't think it was due to my code, but this is another subject. :)

Thanks again!
 
Old 10-14-2009, 12:47 PM   #7
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Any time. I have my contact info in my profile, if something get's urgent.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS6.3 livecd "ls : command not found" error after "su - lfs" rotu Linux From Scratch 2 06-19-2008 03:59 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
executing a loaded module returns "command not found" error neelay1 Linux - Software 1 05-08-2006 02:25 PM
User Login Problem: "command not found" unless root! DreameR-X Linux - General 15 12-21-2004 11:27 AM
problem using ifup and ifconfig "command not found" sicgixxer Linux - Networking 2 11-11-2004 09:39 PM


All times are GMT -5. The time now is 06:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration