Reference
Julia clusters
Distributed.addprocs — Functionaddprocs(template, ninstances[; kwargs...])Add Azure scale set instances where template is either a dictionary produced via the AzManagers.build_sstemplate method or a string corresponding to a template stored in ~/.azmanagers/templates_scaleset.json.
key word arguments:
subscriptionid=AzManagers._manifest["subscriptionid"]resourcegroup=AzManagers._manifest["resourcegroup"]sigimagename=""The name of the SIG image[1].sigimageversion=""The version of thesigimagename[1].imagename=""The name of the image (alternative tosigimagenameandsigimageversionused for development work).session=AzSession(;lazy=true)The Azure session used for authentication.group="cbox"The name of the Azure scale set. If the scale set does not yet exist, it will be created.ppi=1The number of Julia processes to start per Azure scale set instance.julia_num_threads=Threads.nthreads()set the number of Julia threads to run on each workeromp_num_threads=get(ENV, "OMP_NUM_THREADS", 1)set the number of OpenMP threads to run on each workerenv=Dict()each dictionary entry is an environment variable set on the worker before Julia starts. e.g.env=Dict("OMP_PROC_BIND"=>"close")nretry=20Number of retries for HTTP REST calls to Azure services.verbose=0verbose flag used in HTTP requests.user=AzManagers._manifest["ssh_user"]ssh user.spot=falseuse Azure SPOT VMs for the scale-setmaxprice=-1set maximum price per hour for a VM in the scale-set.-1uses the market price.waitfor=falsewait for the cluster to be provisioned before returning, or return control to the caller immediately[2]mpi_ranks_per_worker=0set the number of MPI ranks per Julia worker[3]mpi_flags="-bind-to core:$(ENV["OMP_NUM_THREADS"]) -map-by numa"extra flags to pass to mpirun (has effect whenmpi_ranks_per_worker>0)
Notes
[1] If addprocs is called from an Azure VM, then the default imagename,imageversion are the image/version the VM was built with; otherwise, it is the latest version of the image specified in the scale-set template. [2] waitfor=false reflects the fact that the cluster manager is dynamic. After the call to addprocs returns, use workers() to monitor the size of the cluster. [3] This is inteneded for use with Devito. In particular, it allows Devito to gain performance by using MPI to do domain decomposition using MPI within a single VM. If mpi_ranks_per_worker=0, then MPI is not used on the Julia workers.
AzManagers.preempted — Functionpreempted([id=myid()])Check to see if the machine id::Int has received an Azure spot preempt message. Returns true if a preempt message is received and false otherwise.
Detached service
AzManagers.addproc — Functionaddproc(template[; basename="cbox", subscriptionid="myid", resourcegroup="mygroup", nretry=10, verbose=0, session=AzSession(;lazy=true), sigimagename="", sigimageversion="", imagename="", detachedservice=true])Create a VM, and returns a named tuple (name,ip,resourcegrup,subscriptionid) where name is the name of the VM, and ip is the ip address of the VM. resourcegroup and subscriptionid denote where the VM resides on Azure.
Parameters
basename="cbox"base name for the VM, we append a random suffix to ensure uniquenesssubscriptionid=AzManagers._manifest["subscriptionid"]Existing Azure subscriptionresourcegorup=AzManagers._manifest["resourcegroup"]Existing Azure resource group inside the subscription in which the VM is putsession=AzSession(;lazy=true)Session used for OAuth2 authenticationsigimagename=""Azure shared image gallery image to use for the VM (defaults to the template's image)sigimageversion=""Azure shared image gallery image version to use for the VM (defaults to latest)imagename=""Azure image name used as an alternative tosigimagenameandsigimageversion(used for development work)nretry=10Max retries for re-tryable REST call failuresverbose=0Verbosity flag passes to HTTP.jl methodsjulia_num_threads=Threads.nthreads()setJULIA_NUM_THREADSenvironment variable before starting the detached processomp_num_threads = get(ENV, "OMP_NUM_THREADS", 1)setOMP_NUM_THREADSenvironment variable before starting the detached processenv=Dict()Dictionary of environemnt variables that will be exported before starting the detached processdetachedservice=truestart the detached service allowing for RESTful remote code execution
AzManagers.@detachat — Macro@detachat myvm begin ... endRun code on an Azure VM.
Example
using AzManagers
myvm = addproc("myvm")
job = @detachat myvm begin
@info "I'm running detached"
end
read(job)
wait(job)
rmproc(myvm)AzManagers.variablebundle — Functionvariablebundle(:key)Retrieve a variable from a variable bundle. See variablebundle! for more information.
AzManagers.variablebundle! — Functionvariablebundle!(;kwargs...)Define variables that will be passed to a detached job.
Example
using AzManagers
variablebundle(;x=1)
myvm = addproc("myvm")
myjob = @detachat myvm begin
write(stdout, "my variable is $(variablebundle(:x))
")
end
wait(myjob)
read(myjob)Base.read — Functionread(job[;stdio=stdout])returns the stdout from a detached job.
AzManagers.rmproc — Functionrmproc(vm[; session=AzSession(;lazy=true), verbose=0, nretry=10])Delete the VM that was created using the addproc method.
Parameters
session=AzSession(;lazy=true)Azure session for OAuth2 authenticationverbose=0verbosity flag passed to HTTP.jl methodsnretry=10max number of retries for retryable REST calls
AzManagers.status — Functionstatus(job)returns the status of a detached job.
Base.wait — Functionwait(job[;stdio=stdout])blocks until the detached job, job, is complete.
Configuration
AzManagers.build_nictemplate — FunctionAzManagers.build_nictemplate(nic_name; kwargs...)Returns a dictionary for a NIC template, and that can be passed to the addproc method, or written to AzManagers.jl configuration files.
Required keyword arguments
subscriptionidAzure subscriptionresourcegroup_vnetAzure resource group that holds the virtual network that the NIC is attaching to.vnetAzure virtual network for the NIC to attach to.subnetAzure sub-network name.locationlocation of the Azure data center where the NIC correspond to.
AzManagers.build_sstemplate — FunctionAzManagers.build_sstemplate(name; kwargs...)returns a dictionary that is an Azure scaleset template for use in addprocs or for saving to the ~/.azmanagers folder.
required key-word arguments
subscriptionidAzure subscriptionlocationAzure data-center locationresourcegroupAzure resource-groupimagegalleryAzure image gallery that contains the VM imageimagenameAzure imagevnetAzure virtual network for the scalesetsubnetAzure virtual subnet for the scalesetskunameAzure VM type
optional key-word arguments
subscriptionid_imageAzure subscription corresponding to the image gallery, defaults tosubscriptionidresourcegroup_vnetAzure resource group corresponding to the virtual network, defaults toresourcegroupresourcegroup_imageAzure resource group correcsponding to the image gallery, defaults toresourcegroupskutier = "Standard"Azure SKU tier.- `tempdisk = "sudo mkdir -m 777 /mnt/scratch
ln -s /mnt/scratch /scratch"` cloud-init commands used to mount or link to temporary disk
AzManagers.build_vmtemplate — FunctionAzManagers.build_vmtemplate(vm_name; kwargs...)Returns a dictionary for a virtual machine template, and that can be passed to the addproc method or written to AzManagers.jl configuration files.
Required keyword arguments
subscriptionidAzure subscriptionlocationAzure data center locationresourcegroupAzure resource group where the VM will resideimagegalleryAzure shared image gallery nameimagenameAzure image name that is in the shared image galleryvnetAzure virtual networksubnetAzure subnetvmsizeAzure vm type, e.g. "StandardD8sv3"
Optional keyword arguments
resourcegroup_vnetAzure resource group containing the virtual network, defaults toresourcegroupsubscriptionid_imageAzure subscription containing the image gallery, defaults tosubscriptionidresourcegroup_imageAzure resource group containing the image gallery, defaults tosubscriptionidnicname = "cbox-nic"Name of the NIC for this VM- `tempdisk = "sudo mkdir -m 777 /mnt/scratch
ln -s /mnt/scratch /scratch"` cloud-init commands used to mount or link to temporary disk
AzManagers.write_manifest — FunctionAzManagers.write_manifest(;resourcegroup="", subscriptionid="", ssh_user="", ssh_public_key_file="~/.ssh/azmanagers_rsa.pub", ssh_private_key_file="~/.ssh/azmanagers_rsa")Write an AzManagers manifest file (~/.azmanagers/manifest.json). The manifest file contains information specific to your Azure account.
AzManagers.save_template_nic — FunctionAzManagers.save_template_nic(nic_name, template)Save template::Dict generated by AzManagers.buildnictmplate to /home/runner/.azmanagers/templatesnic.json.
AzManagers.save_template_scaleset — FunctionAzManagers.save_template_scaleset(scalesetname, tempate)Save template::Dict generated by AzManagers.buildsstmplate to /home/runner/.azmanagers/templatesscaleset.json.
AzManagers.save_template_vm — FunctionAzManagers.save_template_vm(vm_name, template)Save template::Dict generated by AzManagers.buildvmtmplate to /home/runner/.azmanagers/templatesvm.json.