KBEA-00102 - Using the Electrify wrapper application

Article ID:360032826412
3 minute readKnowledge base

Summary

This article discusses how to use the Electrify wrapper application (electrify_proxy).

Due to improvements in ElectricAccelerator 6.0, using the wrapper application is no longer necessary (refer to the Electrify chapter in the ElectricAccelerator 6.0 Electric Make Users Guide for information about using Electrify). The wrapper application is, however, still a valid way to use Electrify.

Solution

There are two methods available for wrapping commands:

Wrapping commands method 1

Copy the electrify_proxy executable (electrify_proxy.exe or electrify_proxy, depending on the platform) into the appropriate directory as the commands you want to parallelize.

MSBuild/Devenv example
MSBuild looks for cl.exe, link.exe, and so on, in its own directory. This means you must copy electrify_proxy.exe to the VC\bin directory as cl.exe, link.exe, and so on.

SCons example
Create a directory for electrify_proxy: /c/src/electrify_proxy/. Then copy the electrify_proxy executable into that directory using the name of the command you will run, for example /c/src/electrify_proxy/gcc (or gcc.exe depending on the platform).

Wrapping commands method 2

Use the electrify_proxy executable and explicitly specify the command to be invoked. This allows you to embed the decisions about which tools to proxy in your SConstruct (and other) files.

Example
electrify_proxy gcc …​

Setting the Parallelization level

Most build tools that support parallel execution allow you to configure a worker or thread count, which controls the level of parallelization used. (This is commonly configured through a parameter such as -j.) When using these tools with Electrify, it is generally desirable to set this value higher than usual because the number of parallel actions determines how quickly Electrify discovers work to distribute. A high count helps to ensure Electrify remains busy. For example, when using SCons, set -j at 2-3 times the number of ElectricAccelerator agents available to a build.

When using MSBuild with Electrify, it is important to keep the number of worker processes (configured with the /m switch) lower than the number of agents used if you are distributing calls to link.exe.

Running Electrify

MSBuild example
electrify --emake-cm=hostname [ec:args] — msbuild /m:8 /t:rebuild /nr:false solution.sln

Devenv example
electrify --emake-cm=hostname [ec:args] — devenv solution.sln /build

SCons example
electrify --emake-cm=hostname [ec:args] --emake-proxy-dir= — scons -j 16

The --emake-proxy-dir= argument sets the electrify_proxy directory. Using the example in Wrapping commands method 1, it would be --emake-proxy-dir=/c/src/electrify_proxy
Examples contains a more detailed SCons example.

Important reminders
  • You must use — between eMake arguments and other tool commands.

  • Though all of the usual eMake arguments are available, Electrify uses only a subset of them.

  • Using electrify_proxy may require additional libraries. For example, if you copied the executable to gcc, do one of the following:

    • Set LD_LIBRARY_PATH to include /opt/ecloud/i686_Linux/lib
      or

    • Set up the electrfy_proxy directory as
      ./proxies/bin/gcc
      ./proxies/lib/
      Then use --emake-proxy-dir=./proxies/bin rather than just ./proxies.

  • After upgrading Accelerator - You must refresh the following (You must do this manually; it is not part of the install/upgrade process.):

    • If there is an Electrify build with a proxy dir on the eMake machine specified with the --emake-proxy-dir option, old renamed copies of electrify_proxy that are contained there with the binary contents of the updated electrify_proxy program (electrify_proxy.exe for Windows)

    • Any commands that are used, for example, cl.exe, that are overwritten by electrify_proxy.exe

Examples

Additional SCons example for Linux:

This example uses the following .C and SConstruct files:

hello.c file

#include
int main()
{
   printf("Hello, world\!\n");
}

SConstruct file

Program ('hello.c')

In order for Electrify to know which tools to use, uses the --emake-proxy-dir argument. This example uses /electrify_proxy_files to contain the tools and supported files.

mkdir \-p /electrify_proxy_files/bin
mkdir -p /electrify_proxy_files/lib
cp /opt/ecloud/i686_Linux/bin/electrify_proxy /electrify_proxy_files/bin/gcc
cp /opt/ecloud/i686_Linux/bin/electrify_proxy /electrify_proxy_files/bin/g++
cp /opt/ecloud/i686_Linux/bin/lib/libstdc++.so.6 /electrify_proxy_files/lib/libstdc++.so.6

You are now ready to build with Scons using one of the following commands:

electrify --emake-cm= --emake-proxy-dir=/electrify_proxy_files/bin -- scons -j 2

or

electrify --emake-cm= --emake-proxy-dir=/electrify_proxy_files/bin -- electrifymon scons -j 2

Applies to

  • Product versions: 5.0 and later

  • OS versions: All