(c) 2003 Copyright A.V.Gerbessiotis. All right reserved. HOW TO SETUP A WIN 2000 cluster with Critical Software's WMPI2. 1. Let the machines of the cluster for the sake of an example be pcc1,pcc2,pcc3, pcc4. Machine pcc1 will be the front-end (license server etc). 2. Remove first prior versions of WMPI in the system. Make sure that this removal also removes some WMPI daemons/processes that may be running on these machines. Note 1: It is critical to do so. Otherwise WMPI2 and WMPI1.x daemons/processes may interfere! 3. Instal WMPI on the intended cluster. Follow instructions by installing it first on pcc1 and then add pcc2,pcc3, pcc4 in the configuration list. If you wish add an environment variable in pcc1 for the default cluster configuration file to override the current default which is is something like wmpicluster.conf. I keep the name short, something like chosts. 4. After installation, register the user name of the account you will use to run an MPI program. If you don't register your user name you will have to type in passwords twice every time you run a program. THis is done once per machine. Reboot for safety each one of these machines to make sure that WMPI2 was installed properly and correctly. 5. On PCC1, create a shared directory, say \clusterbin readable by the other users. 6. On each one of the cluster machines including PCC1 map the \\pcc1\clusterbin directory to a common drive name, say E: Thus E:\ on PCC3 is in fact \\pcc1\clusterbin 7. In clusterbin you maintain your executable files. Say one such file is runme.exe. If you run the executable at that place by doing at PCC1 % cd C:\clusterbin\ % runme.exe make sure that \clusterbin contains the chosts file (per step 3) and a runme.pg file. I prefer to use a generic wmpi.pg file instead. The chosts file (wmpicluster.conf) contains the cluster configuration, i.e. it is of the form ---------------CONTENTS OF CHOSTS begin below --------------- /machines PCC1 PCC2 PCC3 PCC4 --------------Endof Contents -------------------------------- The wmpi.pg (or equivalent file) tells WMPI2 how to run a program. For our setup it can look like ---------------CONTENTS OF wmpi.pg begin below --------------- PCC1 1 "E:\runme.exe" PCC2 1 "E:\runme.exe" PCC3 1 "E:\runme.exe" PCC4 1 "E:\runme.exe" --------------Endof Contents -------------------------------- Note2: If you run C:\clustebin > runme.exe from the command line of PCC1 then 5 processes are spawn. Two at PCC1 (the one of the command line and the one of the first line of wmpi.pg) and three (one each) at PCC2,PCC3, and PCC4. If command line arguments are required, then they are listed after the executable name both in the commandline and wmpi.pg as follows. ---------------CONTENTS OF wmpi.pg begin below --------------- PCC1 1 "E:\runme.exe" 1 2 PCC2 1 "E:\runme.exe" 1 2 PCC3 1 "E:\runme.exe" 1 2 PCC4 1 "E:\runme.exe" 1 2 --------------Endof Contents -------------------------------- C:\clustebin > runme.exe 1 2 where we assume runme requires two arguments with values 1 and 2. 8. License server. I have installed a trial version of Critical Software WMPI on a four processor PC cluster. Each machine happens to be a dual-processor SMP box. Apparently, the license server allows me to run processes on 3 machines only. I can 4 processes if my cluster is configured for two machines (eg. PCC1 and PCC2) and i run 2 processes per machine (i.e. my wmpi.pg file looks like). ---------------CONTENTS OF wmpi.pg begin below --------------- PCC1 1 "E:\runme.exe" 1 2 PCC2 1 "E:\runme.exe" 1 2 PCC2 1 "E:\runme.exe" 1 2 --------------Endof Contents -------------------------------- C:\clustebin > runme.exe 1 2 Final Note: the 1 after the name of the machine indicates the number of processes to be run. One could write instead for wmpi.pg above ---------------CONTENTS OF wmpi.pg begin below --------------- PCC1 1 "E:\runme.exe" 1 2 PCC2 2 "E:\runme.exe" 1 2 --------------Endof Contents -------------------------------- 9.How to Compile an MPI Program? Get Visual C++. Assuming you know the basics or are willing to learn them create a workspace, a project for a console application (i always) do so), and a simple program (not just the "hello wolrd" type). Read the Critical Software's instructions on how to compile a C/C++ programs. This require among other things. Project|Settings 1. In the C++ box and under Code generation and Preprocessor make sure you include the proper directories eg. $(MPI2_ROOT)\include and create Multithreaded DLL applications. 2. In the Link box make sure you include the $(MPI2_ROOT)\lib directory for linking and also include at the end of the list of libraries wmpi2.lib (WMPI's library) You may also wish to include ws2_32.lib (Microsoft's winsocket library?). 3. If you like to run programs from visual C++ then include in the C++ box in step 1 above the command line arguments of the program. Make sure, however, that the Debug and Release directories of your code have copies of wmpi.pg and chosts files in addition to the E:\ directory. Make also sure the executable is available at the places listed in wmpi.pg as well. I avoid this mess and use the command line to run programs from E:\. 4. Make sure you include in every source file a #include or you will get the C1010 error message.o 5 MPI related comments. i. IF your original code run fine under LAM-MPI with an include #include "mpi.h" before it runs under WMPI, change it into #include "mpi2.h" to run a program. 6. LINUX vs WIN comments function gethostname require an #include under LINUX. For Visual C++ use #include and make sure you include the appropriate library (step 2). 7. GCC vs Visual C++ comments. I write C code and like to declar a function mult(); this way even if it should be defined mult(double *, double *, double *, int); VISUAL C++ is not forgiving or I don't know (and i donot know) how to make it forgiving. 8. Oh! If you have parallel prefix (or scan or reduce) code in you mpi program make sure there is no variable or name called operator (like the C++ keyword) or funny things may happen! 10. How to create a visual C++ project with multiple files. 1. When you create your project and the global calss main include your main file of the program by inputting there the corresponding text file. Make sure that the project name has the same name as the file. 2. To attach to this project other .c or .h file goto project, add to project, a header or a source file and you file the initially empty header of source file by inputting your original file; do not forget to include the stdafx.h file every time as noted before. 3. If you prefer make files (Microsoft's nmake) and the command line make sure that when you installed Visual studio you clicked the appropriate option. Otherwise you need to go to the $(VISUAL_STUDIO_INSTALL_DIRECTORY)\bin directory where you installed C++ and execute a .bat file that is there that sets the appropriate path variable for you namely, PATH, LIB, INCLUDE to point to $(VISUAL_STUDIO_INSTALL_DIRECTORY)\bin $(VISUAL_STUDIO_INSTALL_DIRECTORY)\lib $(VISUAL_STUDIO_INSTALL_DIRECTORY)\include and some other .dll's. 11. There may be simpler ways to work with WMPI2 and Win2000/Visual C++ but i couldn't find them. This is a summary of my experiences and my methodology of dealing with both.