Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Expose the available devices from the _ExecutionContext. #398

Merged
merged 2 commits into from
Jul 29, 2019

Conversation

saeta
Copy link
Contributor

@saeta saeta commented Jul 28, 2019

In order for code to determine what sort of parallelism strategies make sense,
we need to expose the list of available devices on the host. This change makes
the list of available devices publicly readable.

This change also orders the list of test suites alphabetically.

In order for code to determine what sort of parallelism strategies make sense,
we need to expose the list of available devices on the host. This change makes
the list of available devices publicly readable.

This change also orders the list of test suites alphabetically.
@saeta saeta requested a review from bgogul July 28, 2019 22:38
@saeta
Copy link
Contributor Author

saeta commented Jul 28, 2019

Thanks for the super fast review @rxwei ! PTAL?

@saeta saeta requested a review from rxwei July 28, 2019 22:56
@eaplatanios
Copy link
Contributor

Could we instead make this return an array of Device where Device is something like this?

public struct Device {
    public let job: String?
    public let replica: Int?
    public let task: Int?
    public let type: DeviceType
    public let index: Int
}

public enum DeviceType {
  case cpu, gpu, tpu
}

This would be both more Swifty and also easier to manage on the user-side so that the user does not have to handle any string parsing, etc.

@rxwei
Copy link
Contributor

rxwei commented Jul 29, 2019

We definitely could in the future, but note that ‘_ExecutionContext’ is itself not a public API (it’s underscored) and all of this is experimental.

@Shashi456
Copy link
Contributor

Does this api ultimately give way for functions like isCudaAvailable and shifting data from gpu to cpu and so on so forth? or am i wrong in my understanding

testCase(LazyTensorTests.allTests),
testCase(LazyTensorTraceTests.allTests),
testCase(LazyTensorExplicitTraceTests.allTests),
testCase(LazyTensorOperationTests.allTests),
testCase(LazyTensorTFFunctionBuilderTests.allTests),
testCase(LazyTensorEvaluationTests.allTests),
testCase(LossTests.allTests),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually good idea to keep unrelated changes in a separate PR?

@eaplatanios eaplatanios merged commit 5c8b8ee into master Jul 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants