Configuring Bedrock using Jx9

JSON configurations for Bedrock can very quickly become complicated to write by hand, especially when trying to list many execution streams for use in a many-core node, associated with as many pools and providers. This is where Jx9 can help again.

By using the --jx9 argument of the bedrock program, one can use a Jx9 program instead of a JSON file to generate the configuration.

The code bellow is an example of such a Jx9-based configuration. It first initializes a base configuration, then uses a loop to add as many pools as requested in the argobots section.

$config = {
   margo : {
     argobots : {
       pools : [
         {
           name : "my_pool"
         }
       ]
     }
  }
};

for ($i = 0; $i < $num_extra_pools; $i++) {
  $pool_name = sprintf("extra_pool_$i");
  array_push($config.margo.argobots.pools,
    {
       name : $pool_name
    }
  );
}

return $config;

Bedrock can use this file as follows.

bedrock ofi+tcp --jx9 -c example.jx9 --jx9-context num_extra_pools=4

The --jx9-context argument allows setting variables before the Jx9 script is executed, in the form of coma-separated assignments (e.g. x=1,y=2.5,z="abc" ).