Skip to content

Commit 6211b88

Browse files
authored
add how to for using intellij (#305)
1 parent 5965492 commit 6211b88

14 files changed

+173
-0
lines changed

site/docs/getting-started/3-whats-next.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Congratulations! You have just learned how to design and experiment with a (virt
99
- Follow one of the [tutorials](/docs/category/tutorials) using OpenDC.
1010
- Read about [existing work using OpenDC](/community/research).
1111
- Get involved in the [OpenDC Community](/community/support).
12+
- If you are interested in contributing to OpenDC you can find a How-To here [4-start-using-intellij](4-start-using-intellij.md), please also read https://github.com/atlarge-research/opendc/blob/master/CONTRIBUTING.md.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
2+
3+
# In this How-To we explain how you setup IntelliJ IDEA
4+
5+
First of all you can download IntelliJ here: https://lp.jetbrains.com/intellij-idea-promo/
6+
7+
# Basic steps
8+
9+
```
10+
git clone git@github.com:atlarge-research/opendc
11+
```
12+
13+
Check if you have a compatible java version available. Make sure to have one of these versions available: [19, 20, 21]
14+
15+
If not install a supported version!
16+
17+
On a MAC
18+
19+
```
20+
/usr/libexec/java_home -V
21+
```
22+
23+
On Debian
24+
25+
```
26+
update-alternatives --list java
27+
```
28+
29+
On Redhat/Centos
30+
31+
```
32+
yum list installed | grep java
33+
```
34+
35+
36+
Open the project in IntelliJ
37+
38+
![Intellij Open Project](img/intellij_open_project.png)
39+
40+
Now fix the settings so that you use the correct java version. (In the example the java version is set to "21")
41+
Navigation path in the settings pannel: "Build, Execution, Deployment" -> "Build Tools" -> "Gradle"
42+
43+
![Intellij Settings](img/intellij_settings.png)
44+
45+
Now navigate in the file menu to and open the file: "gradle"/"libs.versions.toml"
46+
47+
Make sure the java version is set to the same version as previously cofigured in the settings.
48+
49+
![Intellij Libs Versions Toml](img/intellij_libs_versions_toml.png)
50+
51+
52+
Now open the Gradle panel on the right-hand side of the editor (1) and hit the refresh button at the top of the panel (2).
53+
54+
![Intellij Gradle Panel](img/intellij_gradle_panel.png)
55+
56+
57+
# Setup your first experiment and run it from source
58+
59+
60+
Create a directory where you are going to put the files for your first experiment.
61+
62+
File structure:
63+
64+
![Experiment File Structure](img/experiment_file_structure.png)
65+
66+
You can download the example workload trace (bitbrains-small-9d2e576e6684ddc57c767a6161e66963.zip) [here](https://atlarge-research.github.io/opendc/assets/files/bitbrains-small-9d2e576e6684ddc57c767a6161e66963.zip)
67+
68+
Now unzip the trace.
69+
70+
The content of "topology.json"
71+
72+
```
73+
{
74+
"clusters":
75+
[
76+
{
77+
"name": "C01",
78+
"hosts" :
79+
[
80+
{
81+
"name": "H01",
82+
"cpu":
83+
{
84+
"coreCount": 32,
85+
"coreSpeed": 3200
86+
},
87+
"memory": {
88+
"memorySize": 256000
89+
}
90+
}
91+
]
92+
},
93+
{
94+
"name": "C02",
95+
"hosts" :
96+
[
97+
{
98+
"name": "H02",
99+
"count": 6,
100+
"cpu":
101+
{
102+
"coreCount": 8,
103+
"coreSpeed": 2930
104+
},
105+
"memory": {
106+
"memorySize": 64000
107+
}
108+
}
109+
]
110+
},
111+
{
112+
"name": "C03",
113+
"hosts" :
114+
[
115+
{
116+
"name": "H03",
117+
"count": 2,
118+
"cpu":
119+
{
120+
"coreCount": 16,
121+
"coreSpeed": 3200
122+
},
123+
"memory": {
124+
"memorySize": 128000
125+
}
126+
}
127+
]
128+
}
129+
]
130+
}
131+
```
132+
133+
The content of "experiment.json"
134+
135+
The paths in the "experiment.json" file are relative to the "working directory" which is configured next.
136+
137+
138+
```
139+
{
140+
"name": "simple",
141+
"topologies": [{
142+
"pathToFile": "topology.json"
143+
}],
144+
"workloads": [{
145+
"pathToFile": "bitbrains-small",
146+
"type": "ComputeWorkload"
147+
}]
148+
}
149+
```
150+
151+
In the project file structure on the left open the following file:
152+
153+
"opendc-experiments"/"opendc-experiments-base"/"src"/"main"/"kotlin"/"org.opendc.experiment.base"/"runner"/"ExperimentCLi.kt"
154+
155+
![Intellij Experimentcli](img/Intellij_experimentcli.png)
156+
157+
Now open the "Run/Debug" configuration (top right).
158+
159+
![Intellij Open Run Config](img/intellij_open_run_config.png)
160+
161+
We need to edit two settings:
162+
163+
"Program arguments": --experiment-path experiment.json
164+
165+
"Working Directory": a path where you have put the experiment files
166+
167+
![Intellij Edit The Run Config](img/intellij_edit_the_run_config.png)
168+
169+
Now you can click "Run" and start your first experiment.
170+
171+
In the working directory a "output" direcotry is created with the results of the experiment.
172+
152 KB
Loading
18.2 KB
Loading
98.2 KB
Loading
490 KB
Binary file not shown.
20.8 KB
Loading
161 KB
Binary file not shown.
66.3 KB
Loading
253 KB
Binary file not shown.

0 commit comments

Comments
 (0)