-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user_cpu_context and ability to provide host_policy via it
- Loading branch information
1 parent
4eb47a5
commit bee0243
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************* | ||
* Copyright 2023 Intel Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
#include "oneapi/dal/detail/user_policy.hpp" | ||
|
||
namespace oneapi::dal::detail { | ||
class user_cpu_context_impl { | ||
public: | ||
user_cpu_context_impl() : policy_(host_policy::get_default()) {} | ||
user_cpu_context_impl(const host_policy& policy) : policy_(policy) {} | ||
void set_host_policy(const host_policy& policy) { | ||
policy_ = policy; | ||
} | ||
host_policy get_host_policy() { | ||
return policy_; | ||
} | ||
|
||
private: | ||
detail::host_policy policy_; | ||
}; | ||
|
||
user_cpu_context::user_cpu_context() : impl_(new user_cpu_context_impl()) {} | ||
|
||
user_cpu_context::user_cpu_context(const host_policy& policy) | ||
: impl_(new user_cpu_context_impl(policy)) {} | ||
|
||
void user_cpu_context::set_host_policy(const host_policy& policy) { | ||
impl_->set_host_policy(policy); | ||
} | ||
|
||
host_policy user_cpu_context::get_host_policy() { | ||
return impl_->get_host_policy(); | ||
} | ||
|
||
} // namespace oneapi::dal::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright 2023 Intel Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
#include "oneapi/dal/detail/policy.hpp" | ||
|
||
namespace oneapi::dal::detail { | ||
class user_cpu_context_impl; | ||
|
||
class user_cpu_context { | ||
public: | ||
user_cpu_context(); | ||
user_cpu_context(const host_policy& policy); | ||
host_policy get_host_policy(); | ||
void set_host_policy(const host_policy& policy); | ||
|
||
private: | ||
pimpl<user_cpu_context_impl> impl_; | ||
}; | ||
|
||
} //namespace oneapi::dal::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters