Difference between revisions of "VMPI"
m (→Over the Internet)
Revision as of 02:57, 8 September 2009
VMPI stands for "Valve Message Passing Interface". It was a previously unreleased tool by Valve used for distributed compiles of Source Engine maps. The tool has since then been quietly released around November of 2007 in an update that also Included Orange Box tools for mapping. Both the Episode One and the OB compile tools can use VMPI for distributed map compiles, though the OB compile tool text help has not been updated to show the new command list.
The most popular reason for Valve not releasing VMPI until late 2007 was because it required a MySQL server for tracking network statistics across the master and worker machines. The new VMPI does not require a MySQL server and therefore doesn't have a license restriction for using external code and programs.
How it Works
The new VMPI is significantly different than the old VMPI in the way it works. The most notable difference is that worker machines do not run a system service to "announce" their presence on the network. This means that worker machines are not automatically detected anymore and must be manually started in polling mode before the master starts a compile. It also means that a local copy of Steam must be installed on the worker machines with the Source SDK and at least one Source engine game installed. (previously VMPI uploaded the required files and binaries to a network directory in which all of the worker machines ran from.)
To let it be known before you start, the Orangebox version of VMPI is broken (and has been broken for over a year now) and will not compile a map properly. The problem is known to reside in the code dealing with ambient leaf lighting in VRAD. VVIS on Orangebox is unaffected, and Ep1 VMPI works without any issues.
Before you start a VMPI compile, you need to have at least two machines (one master and one worker.) You also need a copy of Steam and the Source SDK (along with one Source based game) for a compile to work. And sorry kids, you can't use anything older than Windows 2000 (Windows 9x/ME are a no go) for a worker machine.
- To start a master machine in Hammer, all you need to do is add the "-mpi" flag to the compile parameters of both VVIS and VRAD. VBSP cannot be run in VMPI mode, and really doesn't need to be. If you use the command console (cmd.exe) or a batch compiler, it works basically the same as all you need to do is add the flag on. You may also want to add "-low" also so your machine doesn't lock up while compiling a map.
- Starting a worker machine is somewhat different. First, you need to select the right version of compile tools for the job. Ep1 compile tools are not VMPI compatible with Orangebox tools and vice versa. After you figure that out, open a command console (cmd.exe) and navigate to the directory with the compile tools. You can generally use these shortcuts in the command console to get there quicker:
Once you're there, take a look at the master compile process and see which tool that it is currently running. Start VVIS on the worker for VVIS on the master, and VRAD for VRAD. An example to start the worker machine is below:
vvis.exe -mpi_worker <master IP Address> -mpi_port <port> -low
vrad.exe -mpi_worker <master IP Address> -mpi_port <port> -low
If you get an error about missing gameinfo.txt, add this additional flag to tell it where gameinfo.txt is:
-game "%sourcesdk%\..\half-life 2\hl2"
There are several additional options you can set on the compile tools which show things like stats and the total work done. Here is a complete list of the VMPI related commands on the compile tools:
Enable VMPI mode on the master machine.
Used on the worker machine to connect to the master machine. Put the IP Address of the master machine after the command. (Ex: -mpi_worker 192.168.1.100)
Used on the master and worker machines to change the default port number to something else. (Ex: -mpi_Port 2946) The default port VMPI uses is 23311.
Used on the master machine to show a graphical output of the work that's being done. If you have ever used the Windows 9x defragmentation utility, this will look similar to that.
- Grey Blocks - Work units not yet sent.
- Green Blocks - Completed work units.
- Light Green Blocks - Work units assigned to master.
- Blue Blocks - Work units assigned to worker machines.
- Red Blocks - Mentioned as "sent work", usually not seen.
Blue and light green blocks are more specifically single CPUs on a worker and master. If a worker or master has multiple CPUs or CPUs with multiple cores, it will be represented by additional dots. Dual cores will be two, quads will be 4, etc.
Here is an example of 18 processors working on compiling a single map (16 worker CPUs + 2 master.) What's great about the current VMPI is that if you have the correct ports forwarded on your router, you can have machines all over the world help you compile your map. A caveat in this is that both the master and worker machines need decent internet connections with lots of bandwidth, or the workers can time out while downloading resources from the master and slow the compile down.
Used on a worker machine to keep polling a specified master until the master starts a compile. If not used before a master machine starts a compile, the worker will time out and display an "MPI_Init failed" error.
Used on a worker machine to auto-restart polling mode after a compile is finished. This command is buggy and doesn't always work, so don't rely on it. Must be used in conjunction with "-mpi_Retry" if you don't want to keep getting the "MPI_Init failed" message.
Used on the master machine to enable a debug menu during compiles ("-mpi_Graphics" automatically enables it.) To access the menu, press "D" on the keyboard during a compile. This command also seems to be buggy as I have never gotten it to work.
Shows the statistics of the workers used in the compile and how much work they have completed. Statistics are shown after the compile is completed.
Used on the master to delay the compile until a keystroke is pressed. Useful to let workers connect before the master starts the compile.
Used on the master to set the maximum amount of workers allowed in the job.
Used on the master machine to spawn a local worker on the master machine. Only used for testing.
Throttles the rate at which files can be downloaded from the master machine to any given worker machine.
Level of debug output by VMPI. Either 0, 1 or 2.
Don't process work units locally (on the master.) Useful if you only want the master to track compiled data instead of processing work units.
Over the Internet
If you intend to compile over the internet, you must make sure that the end where the master resides has proper port forwarding through its router (if any exist). The default is port 23311 on both TCP and UDP. If you intend to use a non-standard port, make sure that the port is also forwarded on both TCP and UDP.
SENC (Source Extended Net Compiler) provides a GUI for VMPI compiles.
Additionally, its worker comes with a fake (but not in an illegal sense!) Steam installation, allowing you to run workers on whatever machine you please.