VMPI: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(tagged as outdated)
No edit summary
Line 7: Line 7:




An unreleased tool which is used for distributed compiles, reducing the compile time by distributing the work among multiple networked machines. The [[Source Engine]] features page, under the tools header, implies that VMPI is included to licensees as part of the [[Source Engine]] package. It is common belief that Valve did not release VMPI due to licensing issues with MySQL. In order for VMPI to be properly licensed, its source code must be public domain or Valve must purchase a proprietary license from the MySQL allowing distribution of parts of the MySQL code in their program.
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.


There are several parts to have a working VMPI "cluster".
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.


== The MySQL server ==
VMPI uses the SQL server to track statistics on the compile. It does not actually need the SQL server to do a distributed
compile, but it will produce errors when a SQL server isn't present.


==  The master machine==
When the master initiates a VMPI compile, it will only keep track of the compiled data. It will not do any of the compiling
itself (CPU wise). You can make the master machine contribute to the compile if you run a VMPI worker client on the master
but, you may run out of system memory from having two copies of the compile tools running at the same time.


The master initiates a compile by first searching for available non-busy workers. When it finds one or more worker machines,
== How it Works ==
it will upload a specific set of files to a network directory that both the master and the worker machines can see and have
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.)
read / write access to. If one or more worker machines cannot access the uploaded files, the compile will fail.


== The VMPI worker machine ==
== The Master Machine ==
A VMPI worker machine is a computer that has both the <code>vmpi_service</code> and the <code>vmpi_service_ui running</code>. When the <code>vmpi_service</code> is started, it will start broadcasting on the LAN that it is available to start working on compiles. VMPI worker machines do not have to all be mirror images of each other (like beowulf clusters), you may have a plethora of different kinds of hardware as long as they are running some form of Windows NT (Win9x, WinME and Vista don't work very well with VMPI.)
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.
 
[[Image: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.


== The tools ==
* '''-mpi_TrackEvents'''
* '''vmpi_service_ui.exe'''
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.
:This is the UI for the <code>vmpi_service.exe</code>, it will add an octagonal icon to the system tray. the icon has a total of 3 states; one being a brown color with a yellow question mark indicating that it cannot find a <code>vmpi_service</code> process. One being a dark green color indicating that <code>vmpi_service.exe</code> is running and waiting for jobs, and the final variation being a bright green (sometimes accompanied by the system repeatedly beeping out of its PC speaker) indicating that it is working on a compile.


* '''vmpi_service.exe'''
* '''-mpi_ShowDistributeWorkStats'''
:The process that runs on the worker machine that broadcasts itself for available jobs and listens for a master.
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.


* '''vmpi_browser_job_search.exe'''
* '''-mpi_TimingWait'''
:Reads the SQL database and displays information on current and past compiles. This tool is somewhat buggy and doesn't work correctly.
Used on the master to delay the compile until a keystroke is pressed. Useful to let workers connect before the master starts the compile.


* '''vmpi_browser_job_watch.exe'''
* '''-mpi_WorkerCount'''
:A command line tool used to monitor a compile in progress, it is somewhat useful if you can catch the <code>JobID</code> from the compile window before it disappears.
Used on the master to set the maximum amount of workers allowed in the job.


* '''vmpi_browser_services.exe & vmpi_ping.exe'''
* '''-mpi_AutoLocalWorker'''
:These two tools are used to find worker machines on the network. <code>vmpi_ping.exe</code> is the command line version while the latter is the Windows version.
Used on the master machine to spawn a local worker on the master machine. Only used for testing.


* '''vmpi_service_install.exe'''
* '''-mpi_FileTransmitRate'''
:Installs the VMPI worker services on a machine.
VMPI file transmission rate in Kilobytes/second.


* '''WaitAndRestart.exe'''
* '''-mpi_Verbose'''
:Seems to be some sort of reset program to end botched compiles on the network.
Level of debug output by VMPI. Either 0, 1 or 2.


== Options ==
* '''-mpi_NoMasterWorkerThreads'''
VMPI seems to be called by applications such as [[Vvis]] and [[Vrad]] through two command line switches on their respective tools
Don't process work units locally (on the master.) Only used by SDK work unit distributer.


* '''mpi''' - use VMPI to distribute computations.
== 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.)


* '''mpi_pw <password>''' - use a password to choose a specific set of VMPI workers.
tool.exe -game "gamepath\gamedir" -mpi_Worker <Master IP> -mpi_Port <Master Port>


* '''mpi_workers <integer>''' - specifies the maximum amount of VMPI workers that are allowed to work on a process (defaults to 32).
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 masters router (since data goes both ways) and that both the TCP and UDP protocol are forwarded.


[[Category:Tools]]
[[Category:Tools]]
[[Category:Level Design]]
[[Category:Level Design]]
[[Category:Glossary]]
[[Category:Glossary]]

Revision as of 22:44, 13 January 2008


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 masters router (since data goes both ways) and that both the TCP and UDP protocol are forwarded.