Skip to content

Commit 1387843

Browse files
committed
Update SV-COMP performance testing tool to 2020/2021
- Use EC2 instead of CodeBuild to avoid Docker throttling. - Use a VPC for compatibility with current EC2 spot offerings. - Add profiling using Linux perf as gprof doesn't seem to be working anymore.
1 parent 972a993 commit 1387843

File tree

6 files changed

+484
-292
lines changed

6 files changed

+484
-292
lines changed

scripts/perf-test/build.yaml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
AWSTemplateFormatVersion: 2010-09-09
3+
4+
Parameters:
5+
Ami:
6+
Type: String
7+
8+
AvailabilityZone:
9+
Type: String
10+
11+
Subnet:
12+
Type: String
13+
14+
S3Bucket:
15+
Type: String
16+
17+
PerfTestId:
18+
Type: String
19+
20+
Repository:
21+
Type: String
22+
23+
CommitId:
24+
Type: String
25+
26+
UsePerf:
27+
Type: String
28+
29+
Resources:
30+
EC2Role:
31+
Type: "AWS::IAM::Role"
32+
Properties:
33+
AssumeRolePolicyDocument:
34+
Version: 2012-10-17
35+
Statement:
36+
Effect: Allow
37+
Principal:
38+
Service: ec2.amazonaws.com
39+
Action: "sts:AssumeRole"
40+
RoleName: !Sub "BR-${PerfTestId}"
41+
Policies:
42+
- PolicyName: !Sub "BP-${PerfTestId}"
43+
PolicyDocument:
44+
Version: 2012-10-17
45+
Statement:
46+
- Action:
47+
- "s3:PutObject"
48+
- "s3:GetObject"
49+
Effect: Allow
50+
Resource: !Join ["/", [!Sub "arn:aws:s3:::${S3Bucket}", "*"]]
51+
- Action:
52+
- "s3:ListBucket"
53+
Effect: Allow
54+
Resource: !Sub "arn:aws:s3:::${S3Bucket}"
55+
56+
EC2InstanceProfile:
57+
Type: "AWS::IAM::InstanceProfile"
58+
Properties:
59+
Roles:
60+
- !Ref EC2Role
61+
62+
ReleaseInstance:
63+
Type: "AWS::EC2::Instance"
64+
Properties:
65+
InstanceType: c5.2xlarge
66+
ImageId: !Ref Ami
67+
AvailabilityZone: !Ref AvailabilityZone
68+
SubnetId: !Ref Subnet
69+
IamInstanceProfile: !Ref EC2InstanceProfile
70+
BlockDeviceMappings:
71+
- DeviceName: /dev/xvda
72+
Ebs:
73+
VolumeType: gp2
74+
VolumeSize: '30'
75+
DeleteOnTermination: 'true'
76+
UserData:
77+
Fn::Base64: !Sub |
78+
#!/bin/bash
79+
set -x -e
80+
81+
sed -i 's#/archive.ubuntu.com#/${AWS::Region}.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
82+
export DEBIAN_FRONTEND=noninteractive
83+
apt-get update
84+
apt-get install -y awscli
85+
86+
# AWS Sig-v4 access
87+
aws configure set s3.signature_version s3v4
88+
89+
aws s3 cp s3://${S3Bucket}/ec2-terminate.sh /etc/init.d/ec2-terminate
90+
sed -i '25,31d' /etc/init.d/ec2-terminate
91+
sed -i 's/#S3BUCKET#/${S3Bucket}/g' /etc/init.d/ec2-terminate
92+
sed -i 's/#PERFTESTID#/${PerfTestId}/g' /etc/init.d/ec2-terminate
93+
chmod a+x /etc/init.d/ec2-terminate
94+
update-rc.d ec2-terminate defaults
95+
systemctl start ec2-terminate
96+
97+
trap poweroff EXIT
98+
99+
apt-get install -y build-essential flex bison git curl ccache zip
100+
101+
cd /root/
102+
aws s3 cp s3://${S3Bucket}/release-build-cache/ccache.zip ccache.zip || true
103+
unzip ccache.zip || true
104+
rm -f ccache.zip
105+
ccache -z --max-size=1G
106+
git clone --depth 3 --branch ${CommitId} ${Repository} cbmc.git
107+
cd cbmc.git
108+
echo ${Repository} > COMMIT_INFO
109+
git rev-parse --short HEAD >> COMMIT_INFO
110+
git log HEAD^..HEAD >> COMMIT_INFO
111+
make -C src minisat2-download glucose-download cadical-download
112+
export CCACHE_NOHASHDIR=1
113+
make -C src CXX="ccache g++" -j8
114+
ccache -s
115+
116+
aws s3 cp src/cbmc/cbmc s3://${S3Bucket}/${PerfTestId}/release/cbmc
117+
aws s3 cp src/goto-cc/goto-cc s3://${S3Bucket}/${PerfTestId}/release/goto-cc
118+
aws s3 cp COMMIT_INFO s3://${S3Bucket}/${PerfTestId}/release/COMMIT_INFO
119+
cd /root/
120+
zip -r ccache.zip .ccache
121+
aws s3 cp ccache.zip s3://${S3Bucket}/release-build-cache/ccache.zip
122+
123+
ProfilingInstance:
124+
Type: "AWS::EC2::Instance"
125+
Properties:
126+
InstanceType: c5.2xlarge
127+
ImageId: !Ref Ami
128+
AvailabilityZone: !Ref AvailabilityZone
129+
SubnetId: !Ref Subnet
130+
IamInstanceProfile: !Ref EC2InstanceProfile
131+
BlockDeviceMappings:
132+
- DeviceName: /dev/xvda
133+
Ebs:
134+
VolumeType: gp2
135+
VolumeSize: '30'
136+
DeleteOnTermination: 'true'
137+
UserData:
138+
Fn::Base64: !Sub |
139+
#!/bin/bash
140+
set -x -e
141+
142+
sed -i 's#/archive.ubuntu.com#/${AWS::Region}.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
143+
export DEBIAN_FRONTEND=noninteractive
144+
apt-get update
145+
apt-get install -y awscli
146+
147+
# AWS Sig-v4 access
148+
aws configure set s3.signature_version s3v4
149+
150+
aws s3 cp s3://${S3Bucket}/ec2-terminate.sh /etc/init.d/ec2-terminate
151+
sed -i '25,31d' /etc/init.d/ec2-terminate
152+
sed -i 's/#S3BUCKET#/${S3Bucket}/g' /etc/init.d/ec2-terminate
153+
sed -i 's/#PERFTESTID#/${PerfTestId}/g' /etc/init.d/ec2-terminate
154+
chmod a+x /etc/init.d/ec2-terminate
155+
update-rc.d ec2-terminate defaults
156+
systemctl start ec2-terminate
157+
158+
trap poweroff EXIT
159+
160+
apt-get install -y build-essential flex bison git curl ccache zip
161+
162+
cd /root/
163+
aws s3 cp s3://${S3Bucket}/profiling-build-cache/ccache.zip ccache.zip || true
164+
unzip ccache.zip || true
165+
rm -f ccache.zip
166+
ccache -z --max-size=1G
167+
git clone --depth 3 --branch ${CommitId} ${Repository} cbmc.git
168+
cd cbmc.git
169+
echo ${Repository} > COMMIT_INFO
170+
git rev-parse --short HEAD >> COMMIT_INFO
171+
git log HEAD^..HEAD >> COMMIT_INFO
172+
make -C src minisat2-download glucose-download cadical-download
173+
export CCACHE_NOHASHDIR=1
174+
if [ x${UsePerf} = xTrue ]
175+
then
176+
make -C src CXX="ccache g++" -j8 CXXFLAGS="-O2 -g -Wno-deprecated -fno-omit-frame-pointer"
177+
else
178+
make -C src CXX="ccache g++" -j8 CXXFLAGS="-O2 -pg -g -finline-limit=4 -Wno-deprecated" LINKFLAGS="-pg"
179+
fi
180+
ccache -s
181+
182+
aws s3 cp src/cbmc/cbmc s3://${S3Bucket}/${PerfTestId}/profiling/cbmc
183+
aws s3 cp src/goto-cc/goto-cc s3://${S3Bucket}/${PerfTestId}/profiling/goto-cc
184+
aws s3 cp COMMIT_INFO s3://${S3Bucket}/${PerfTestId}/profiling/COMMIT_INFO
185+
cd /root/
186+
df -h
187+
zip -r ccache.zip .ccache
188+
aws s3 cp ccache.zip s3://${S3Bucket}/profiling-build-cache/ccache.zip
189+
190+
Outputs:
191+
ReleaseInstanceId:
192+
Value: !Ref ReleaseInstance
193+
ProfilingInstanceId:
194+
Value: !Ref ProfilingInstance

scripts/perf-test/codebuild.yaml

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)