Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Example setup #33

Closed
Thomasdezeeuw opened this issue Nov 27, 2018 · 5 comments
Closed

Example setup #33

Thomasdezeeuw opened this issue Nov 27, 2018 · 5 comments
Assignees

Comments

@Thomasdezeeuw
Copy link
Contributor

We're doing the Lab exercise for Distributed Systems, at the VU, and we're having trouble creating a setup file for the SC18PlatformRunner. We've tried the website, but that failed (see atlarge-research/opendc-frontend#66). We've also found Sc18SetupParser, but its somewhat hard to reverse-engineer a good setup from that.

Could you provide an example setup file? Or provide/link to documentation on the format of this setup file?

@fabianishere
Copy link
Member

The simulator is unfortunately pretty tightly coupled to the database (or at least Hibernate) at the moment, so my apologies for the trouble you are having to go through.

But to get back on point, examples of such a setup file and accompanying traces can be found in the SC18 release. An example of such a setup file:

{
	"name": "Experimental Setup 2",
	"rooms": [
		{
			"type": "SERVER",
			"objects": [
				{
					"type": "RACK",
					"machines": [
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]},
						{ "cpus": [2] }, { "cpus": [2]}
					]
				},
				{
					"type": "RACK",
					"machines": [
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]},
						{ "cpus": [1] }, { "cpus": [1]}
					]
				}
			]
		}
	]
}

This is a JSON file that models a very basic datacenter (like you can construct on opendc.org). This datacenter contains a single server room with two racks:

  • A rack containing 16 machines with a single CPU of type 2
  • A rack containing 16 machines with a single CPU of type 1

The two CPU types available in this format are:

  1. Intel i7 (4 cores, 4100 MHz)
  2. Intel i5 (2 cores, 3500 MHz).

We are at the moment actively working on establishing a (documented) format for describing datacenter environments and will be implementing it in OpenDC to make these things a bit more easier in the future.

@Thomasdezeeuw
Copy link
Contributor Author

@fabianishere thanks still will give us a good starting point.

@Thomasdezeeuw
Copy link
Contributor Author

Hi @fabianishere I have some more questions, I hope you don't mind I'm reusing this issue for them.

We're implementing a new TaskSortingPolicy. In the policy we need access to information about all the available machines. To access those machines we call context<StageScheduler.State, OdcModel>().run { /* Access to state.machines here. */ }. But the machines are of type com.atlarge.opendc.model.odc.topology.machine.Machine, which do not provide enough information for us. The class code itself can access more CPU details here: https://github.com/atlarge-research/opendc-simulator/blob/master/opendc-model-odc/core/src/main/kotlin/com/atlarge/opendc/model/odc/topology/machine/Machine.kt#L100, which comes from https://github.com/atlarge-research/opendc-simulator/blob/master/opendc-stdlib/src/main/kotlin/com/atlarge/opendc/model/topology/TopologyContext.kt#L49 (I think).

Now my question how can we access those CPU details in a TaskSortPolicy implementation, if at all possible?

If you need more information please ask, or alternatively I can share the changes we've made so far (can't do that publicly (yet)).

@fabianishere
Copy link
Member

Hi @Thomasdezeeuw, no problem!

Notice line 99 in Machine.kt:

override suspend fun Context<State, Topology>.run() = model.run {

Here, model.run brings the methods from TopologyContext into scope.

You can do something similar to access the CPU details in a TaskSortPolicy implementation:

class MySortingPolicy : TaskSortingPolicy {
    override suspend fun sort(tasks: List<Task>): List<Task> = 
        context<StageScheduler.State, OdcModel>().run {
            model.run {
                ...
                val cpus = machine.outgoingEdges.destinations<Cpu>("cpu")
                ...
            }
        }
}

Not the most elegant code unfortunately, but it will do for now :P

@Thomasdezeeuw
Copy link
Contributor Author

Thanks @fabianishere for all your help we've completed our lab, so this can be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants