-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathInitialize.ps1
87 lines (71 loc) · 3.28 KB
/
Initialize.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#----------------------------------------------------------------
# Settings
#----------------------------------------------------------------
$SubscriptionName = "YourSubscriptionName"
$StorageAccountName = "yourstorageaccountname"
$Location = "West Europe"
$AzureWorkerPath = ""
# Reference experiment
$ReferenceExecutablePath = "PathToZippedExecutablePackage.zip"
$ReferenceDomainName = "Z3"
$ReferenceParameters = "model_validate=true -smt2 -file:{0}"
$ReferenceBenchmarkDirectory = "reference"
$ReferenceCategory = null
$ReferenceBenchmarkFileExtension = "smt2|smt"
$ReferenceMemoryLimitMB = 2048.0
$ReferenceBenchmarkTimeout = "00:20:00"
$ReferenceExperimentTimeout = "00:00:00"
$ReferenceRepetitions = 20
# Average runtime of the reference experiment on standard d2 v2 machine (seconds)
$ReferenceValue = 16.34375
#----------------------------------------------------------------
# Script
#----------------------------------------------------------------
Add-AzureAccount
Select-AzureSubscription -SubscriptionName $SubscriptionName –Default
# Create a new storage account.
New-AzureStorageAccount –StorageAccountName $StorageAccountName -Location $Location
# Set a default storage account.
Set-AzureSubscription -CurrentStorageAccountName $StorageAccountName -SubscriptionName $SubscriptionName
#$context = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key
#--------------------------------------------------------------------------------------
# Create storage account containers
Write-Host "Creating containers..."
New-AzureStorageContainer -Name "bin" -Permission Off
New-AzureStorageContainer -Name "config" -Permission Off
New-AzureStorageContainer -Name "input" -Permission Off
New-AzureStorageContainer -Name "output" -Permission Off
New-AzureStorageContainer -Name "results" -Permission Off
#---------------------------------------------------------------------------------------
# Initialize configuration
# Configuration contains binaries required to run benchmarks on Azure Batch nodes and
# definition of a reference experiment.
Write-Host "Uploading reference executable from $ReferenceExecutablePath..."
$ReferenceExperimentBlobName = "reference.zip"
Set-AzureStorageBlobContent -Blob $ReferenceExperimentBlobName -Container "bin" -File $ReferenceExecutablePath
# Initialize reference experiment
$ReferenceJson =
@{
Definition = {
Executable = $ReferenceExperimentBlobName;
DomainName = $ReferenceDomainName;
Parameters = $ReferenceParameters;
BenchmarkContainerUri = 'default';
BenchmarkDirectory = $ReferenceBenchmarkDirectory;
Category = $ReferenceCategory;
BenchmarkFileExtension = $ReferenceBenchmarkFileExtension;
MemoryLimitMB = $ReferenceMemoryLimitMB;
BenchmarkTimeout = $ReferenceBenchmarkTimeout;
ExperimentTimeout = $ReferenceExperimentTimeout;
};
Repetitions = $ReferenceRepetitions;
ReferenceValue = $ReferenceValue
} | ConvertTo-Json
$ReferenceJson >> "reference.json"
Set-AzureStorageBlobContent -Blob 'reference.json' -Container 'config' -File 'reference.json'
Write-Host "Uploading AzureWorker..."
foreach($file in Get-ChildItem $AzureWorkerPath -Include @("*.dll", "*.exe". "*.config") -File)
{
Set-AzureStorageBlobContent -Blob $file.Name -Container 'config' -File $file.FullName
}
# Initialize tables