VMPI

From Valve Developer Community
Revision as of 06:08, 14 January 2008 by Ts2do (talk | contribs) (The VMPI worker machine: apostrophe)

Jump to: navigation, search

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 silently 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 in the way it works than the old VMPI did. 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.)

The Master Machine

To initiate VMPI mode in the compile tools, all you need to do is add the "-mpi" flag to both the vvis.exe and vrad.exe startup options (vbsp.exe does not support VMPI mode and really doesn't need to.) When the compile tools are started in VMPI mode, it will open up a port on the local machine (usually 23311, but can be changed) and will allow worker machines to connect and it will distribute the work. In VMPI mode, unlike the older VMPI, the master machine will contribute to the compile (the old VMPI just used the master machine to store the final compile results, therefore if no workers connected, the map wouldn't compile)

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:

  • -mpi

Enable VMPI mode on the master machine.

  • -mpi_Worker

Used on the VMPI worker to connect to the master machine. Put the IP Address of the master machine after the command. (Ex: -mpi_worker 192.168.1.100)

  • -mpi_Port

Used on the master machine to change the default port number to something else. (Ex: -mpi_Port 2946) The default port VMPI uses is 23311.

  • -mpi_Graphics

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. (Gray blocks = work unit not sent yet, Green = completed work unit, Light Green = work unit being done by master, Blue = work unit being done by a worker machine. There is a mention of a "Red" block as being "sent work" but I have never seen it. The Blue block more specifically is a single CPU on a worker machine. So if a worker machine had 4 processors, it would be represented by 4 blue dots.

Here is an example of 16 processors working on compiling a single map. What's great about the new VMPI is that if you have the correct ports open on your router, you can have machines from all over the world contribute to compiling your map which this image represents. The only downside is that you will want the remote worker to have a low network latency or the worker may time out or slow the compile down. You also need a decent internet upload speed on your end to prevent remote workers from timing out while downloading resources.

Vmpi.jpg

  • -mpi_Retry

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.

  • -mpi_AutoRestart

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 with "-mpi_Retry" if you don't want to keep getting the "MPI_Init failed" message.

  • -mpi_TrackEvents

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.

  • -mpi_ShowDistributeWorkStats

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.

  • -mpi_TimingWait

Used on the master to delay the compile until a keystroke is pressed. Useful to let workers connect before the master starts the compile.

  • -mpi_WorkerCount

Used on the master to set the maximum amount of workers allowed in the job.

  • -mpi_AutoLocalWorker

Used on the master machine to spawn a local worker on the master machine. Only used for testing.

  • -mpi_FileTransmitRate

VMPI file transmission rate in Kilobytes/second.

  • -mpi_Verbose

Level of debug output by VMPI. Either 0, 1 or 2.

  • -mpi_NoMasterWorkerThreads

Don't process work units locally (on the master.) Only used by SDK work unit distributer.

The VMPI worker machine

To start a VMPI worker machine, Steam, Source SDK and at least one Source game must be installed. There is a way to get around installing a source game though. All you have to do is copy the game directory folder over with just gameinfo.txt in it while keeping the directory structure intact. The basing startup line to start a worker is below. (tool.exe being either vvis or vrad.)

tool.exe -game "gamepath\gamedir" -mpi_Worker <Master IP> -mpi_Port <Master Port>

Unless you're running a non-standard VMPI port, you don't need to specify the port number. You also may want to tack "-low" on the end of that string so that the worker machine isn't bogged down and only uses spare CPU idle time. If you want to add a worker to a compile that's not on the local network, you will need to be sure that port 23311 (or whatever port is used by the compile) is forwarded on your router and on the master's router (since data goes both ways) and that both the TCP and UDP protocol are forwarded.