pub struct Platform { /* private fields */ }
Expand description
Structure containing information about an OpenCL platform.
Implementations§
Source§impl Platform
impl Platform
Sourcepub fn get(id: PlatformId) -> Result<Self>
pub fn get(id: PlatformId) -> Result<Self>
Get the platform information for the given platform ID.
§Errors
The following errors may be returned:
Error::InvalidPlatform
- An invalid platform ID was passed.
Examples found in repository?
examples/clinfo.rs (line 26)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn get_all() -> Vec<Platform>
pub fn get_all() -> Vec<Platform>
Get all available platforms.
§Examples
for platform in Platform::get_all() {
println!("Profile: {}", platform.profile());
println!("Version: {}", platform.version());
println!("Name: {}", platform.name());
println!("Vendor: {}", platform.vendor());
println!("Extensions: {}", platform.extensions().join(" "));
}
Examples found in repository?
examples/clinfo.rs (line 6)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn id(&self) -> PlatformId
pub fn id(&self) -> PlatformId
The ID of the platform.
Examples found in repository?
examples/clinfo.rs (line 21)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn profile(&self) -> Profile
pub fn profile(&self) -> Profile
The profile of the platform.
Examples found in repository?
examples/clinfo.rs (line 12)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn version(&self) -> &Version
pub fn version(&self) -> &Version
The OpenCL version of the platform.
Examples found in repository?
examples/clinfo.rs (line 11)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name of the platform.
Examples found in repository?
examples/clinfo.rs (line 9)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn vendor(&self) -> &str
pub fn vendor(&self) -> &str
The vendor of the platform.
Examples found in repository?
examples/clinfo.rs (line 10)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Sourcepub fn extensions(&self) -> &[String]
pub fn extensions(&self) -> &[String]
The available extensions on the platform.
Examples found in repository?
examples/clinfo.rs (line 13)
5fn main() {
6 let platforms = Platform::get_all();
7 println!("Number of platforms {}", platforms.len());
8 for platform in &platforms {
9 println!(" Platform Name {}", platform.name());
10 println!(" Platform Vendor {}", platform.vendor());
11 println!(" Platform Version {}", platform.version());
12 println!(" Platform Profile {}", platform.profile());
13 println!(" Platform Extensions {}", platform.extensions().join(" "));
14 }
15 if !platforms.is_empty() {
16 println!();
17 }
18
19 for platform in &platforms {
20 println!(" Platform Name {}", platform.name());
21 if let Ok(device_ids) = cl_get_device_ids(platform.id(), DeviceType::ALL) {
22 println!("Number of devices {}", device_ids.len());
23 }
24 }
25
26 if let Ok(null_platform) = Platform::get(0) {
27 println!();
28 println!("NULL platform behavior");
29 println!(" clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) {}", null_platform.name());
30 }
31}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Platform
impl RefUnwindSafe for Platform
impl Send for Platform
impl Sync for Platform
impl Unpin for Platform
impl UnwindSafe for Platform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more