Title: XPU Utility Functions — PyTorch main documentation
Description: XPU utility functions in PyTorch C++ — device count, properties, and stream management for Intel GPUs.
Keywords:
Domain: docs.pytorch.org
{
"@context": "https://schema.org",
"@type": "Article",
"name": "XPU Utility Functions",
"headline": "XPU Utility Functions",
"description": "XPU utility functions in PyTorch C++ \u2014 device count, properties, and stream management for Intel GPUs.",
"url": "/api/xpu/utilities.html",
"articleBody": "XPU Utility Functions# High-level utility functions for querying and managing XPU devices. Device Management# size_t torch::xpu::device_count()# Returns the number of XPU devices available. bool torch::xpu::is_available()# Returns true if at least one XPU device is available. void torch::xpu::synchronize(int64_t device_index)# Waits for all kernels in all streams on a XPU device to complete. Example: #include \u003ctorch/torch.h\u003e if (torch::xpu::is_available()) { size_t num_devices = torch::xpu::device_count(); std::cout \u003c\u003c \"Found \" \u003c\u003c num_devices \u003c\u003c \" XPU device(s)\" \u003c\u003c std::endl; // Synchronize all streams on device 0 torch::xpu::synchronize(0); } Random Number Generation# void torch::xpu::manual_seed(uint64_t seed)# Sets the seed for the current GPU. void torch::xpu::manual_seed_all(uint64_t seed)# Sets the seed for all available GPUs. Example: // Set seed for reproducibility on current XPU device torch::xpu::manual_seed(42); // Set seed for all XPU devices torch::xpu::manual_seed_all(42);",
"author": {
"@type": "Organization",
"name": "PyTorch Contributors",
"url": "https://pytorch.org"
},
"image": "https://pytorch.org/docs/stable/_static/img/pytorch_seo.png",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "/api/xpu/utilities.html"
},
"datePublished": "2023-01-01T00:00:00Z",
"dateModified": "2023-01-01T00:00:00Z"
}
| docsearch:language | en |
| llm:site-type | documentation |
| llm:framework | PyTorch |
| llm:description | XPU utility functions in PyTorch C++ — device count, properties, and stream management for Intel GPUs. |
| llm:navigation-file | https://pytorch.org/docs/stable/llms.txt |
| llm:sitemap | https://pytorch.org/docs/stable/sitemap.xml |
| llm:version | main |
| llm:project | PyTorch |
| llm:page-type | documentation |
| og:image | https://docs.pytorch.org/docs/stable/_static/img/pytorch_seo.png |
| None | 3 |
Links:
Viewport: width=device-width, initial-scale=1