2024-06-07 11:28:06 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
< meta name = "generator" content = "Doxygen 1.10.0" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > MLX: mlx/device.h Source File< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< script type = "text/javascript" src = "clipboard.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > MLX
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
< / script >
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(function() { init_search(); });
});
/* @license-end */
< / script >
< div id = "main-nav" > < / div >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
< / script >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div id = "nav-path" class = "navpath" >
< ul >
< li class = "navelem" > < a class = "el" href = "dir_938ab0ecf10b8b860ff766c820f665fd.html" > mlx< / a > < / li > < / ul >
< / div >
< / div > <!-- top -->
< div class = "header" >
< div class = "headertitle" > < div class = "title" > device.h< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< a href = "device_8h.html" > Go to the documentation of this file.< / a > < div class = "fragment" > < div class = "line" > < a id = "l00001" name = "l00001" > < / a > < span class = "lineno" > 1< / span > < span class = "comment" > // Copyright © 2023 Apple Inc.< / span > < / div >
< div class = "line" > < a id = "l00002" name = "l00002" > < / a > < span class = "lineno" > 2< / span > < / div >
< div class = "line" > < a id = "l00003" name = "l00003" > < / a > < span class = "lineno" > 3< / span > < span class = "preprocessor" > #pragma once< / span > < / div >
< div class = "line" > < a id = "l00004" name = "l00004" > < / a > < span class = "lineno" > 4< / span > < / div >
< div class = "line" > < a id = "l00005" name = "l00005" > < / a > < span class = "lineno" > 5< / span > < span class = "keyword" > namespace < / span > < a class = "code hl_namespace" href = "namespacemlx_1_1core.html" > mlx::core< / a > {< / div >
< div class = "line" > < a id = "l00006" name = "l00006" > < / a > < span class = "lineno" > 6< / span > < / div >
< div class = "foldopen" id = "foldopen00007" data-start = "{" data-end = "};" >
< div class = "line" > < a id = "l00007" name = "l00007" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html" > 7< / a > < / span > < span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > {< / div >
< div class = "foldopen" id = "foldopen00008" data-start = "{" data-end = "};" >
< div class = "line" > < a id = "l00008" name = "l00008" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > 8< / a > < / span > < span class = "keyword" > enum class< / span > < a class = "code hl_enumeration" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > DeviceType< / a > {< / div >
< div class = "line" > < a id = "l00009" name = "l00009" > < / a > < span class = "lineno" > 9< / span > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a69ee81924251dec96f1945c9d91506fd" > cpu< / a > ,< / div >
< div class = "line" > < a id = "l00010" name = "l00010" > < / a > < span class = "lineno" > 10< / span > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a45ed081b56ae5d4ddd39c83a5d8a1616" > gpu< / a > ,< / div >
< div class = "line" > < a id = "l00011" name = "l00011" > < / a > < span class = "lineno" > 11< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00012" name = "l00012" > < / a > < span class = "lineno" > 12< / span > < / div >
< div class = "line" > < a id = "l00013" name = "l00013" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#a69ee81924251dec96f1945c9d91506fd" > 13< / a > < / span > < span class = "keyword" > static< / span > < span class = "keyword" > constexpr< / span > < a class = "code hl_enumeration" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > DeviceType< / a > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a69ee81924251dec96f1945c9d91506fd" > cpu< / a > = < a class = "code hl_enumvalue" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdbad9747e2da342bdb995f6389533ad1a3d" > DeviceType::cpu< / a > ;< / div >
< div class = "line" > < a id = "l00014" name = "l00014" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#a45ed081b56ae5d4ddd39c83a5d8a1616" > 14< / a > < / span > < span class = "keyword" > static< / span > < span class = "keyword" > constexpr< / span > < a class = "code hl_enumeration" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > DeviceType< / a > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a45ed081b56ae5d4ddd39c83a5d8a1616" > gpu< / a > = < a class = "code hl_enumvalue" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdba0aa0be2a866411d9ff03515227454947" > DeviceType::gpu< / a > ;< / div >
< div class = "line" > < a id = "l00015" name = "l00015" > < / a > < span class = "lineno" > 15< / span > < / div >
2024-07-12 06:32:08 +08:00
< div class = "line" > < a id = "l00016" name = "l00016" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#a481ccfb94d689994396bd353e966b489" > 16< / a > < / span > < a class = "code hl_function" href = "structmlx_1_1core_1_1_device.html#a481ccfb94d689994396bd353e966b489" > Device< / a > (< a class = "code hl_enumeration" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > DeviceType< / a > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > type< / a > , < span class = "keywordtype" > int< / span > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > index< / a > = 0) : < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > type< / a > (< a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > type< / a > ), < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > index< / a > (< a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > index< / a > ) {}< / div >
2024-06-07 11:28:06 +08:00
< div class = "line" > < a id = "l00017" name = "l00017" > < / a > < span class = "lineno" > 17< / span > < / div >
< div class = "line" > < a id = "l00018" name = "l00018" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > 18< / a > < / span > < a class = "code hl_enumeration" href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > DeviceType< / a > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > type< / a > ;< / div >
< div class = "line" > < a id = "l00019" name = "l00019" > < / a > < span class = "lineno" > < a class = "line" href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > 19< / a > < / span > < span class = "keywordtype" > int< / span > < a class = "code hl_variable" href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > index< / a > ;< / div >
< div class = "line" > < a id = "l00020" name = "l00020" > < / a > < span class = "lineno" > 20< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00021" name = "l00021" > < / a > < span class = "lineno" > 21< / span > < / div >
< div class = "line" > < a id = "l00022" name = "l00022" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core.html#a0196171cfe6ee2953113abce597dc815" > 22< / a > < / span > < span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & < a class = "code hl_function" href = "namespacemlx_1_1core.html#a0196171cfe6ee2953113abce597dc815" > default_device< / a > ();< / div >
< div class = "line" > < a id = "l00023" name = "l00023" > < / a > < span class = "lineno" > 23< / span > < / div >
< div class = "line" > < a id = "l00024" name = "l00024" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120" > 24< / a > < / span > < span class = "keywordtype" > void< / span > < a class = "code hl_function" href = "namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120" > set_default_device< / a > (< span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & d);< / div >
< div class = "line" > < a id = "l00025" name = "l00025" > < / a > < span class = "lineno" > 25< / span > < / div >
< div class = "line" > < a id = "l00026" name = "l00026" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core.html#a937503d72b66c661bf3f5fdcd98ef97c" > 26< / a > < / span > < span class = "keywordtype" > bool< / span > < a class = "code hl_function" href = "namespacemlx_1_1core.html#a937503d72b66c661bf3f5fdcd98ef97c" > operator==< / a > (< span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & lhs, < span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & rhs);< / div >
< div class = "line" > < a id = "l00027" name = "l00027" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core.html#a94d00a1b7f8a4717ab3f26f45e4da655" > 27< / a > < / span > < span class = "keywordtype" > bool< / span > < a class = "code hl_function" href = "namespacemlx_1_1core.html#a94d00a1b7f8a4717ab3f26f45e4da655" > operator!=< / a > (< span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & lhs, < span class = "keyword" > const< / span > < a class = "code hl_struct" href = "structmlx_1_1core_1_1_device.html" > Device< / a > & rhs);< / div >
< div class = "line" > < a id = "l00028" name = "l00028" > < / a > < span class = "lineno" > 28< / span > < / div >
< div class = "line" > < a id = "l00029" name = "l00029" > < / a > < span class = "lineno" > 29< / span > } < span class = "comment" > // namespace mlx::core< / span > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_html" > < div class = "ttname" > < a href = "namespacemlx_1_1core.html" > mlx::core< / a > < / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:7< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_html_a0196171cfe6ee2953113abce597dc815" > < div class = "ttname" > < a href = "namespacemlx_1_1core.html#a0196171cfe6ee2953113abce597dc815" > mlx::core::default_device< / a > < / div > < div class = "ttdeci" > const Device & default_device()< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_html_a312a2de41367fe52caeaf8c0f596a120" > < div class = "ttname" > < a href = "namespacemlx_1_1core.html#a312a2de41367fe52caeaf8c0f596a120" > mlx::core::set_default_device< / a > < / div > < div class = "ttdeci" > void set_default_device(const Device & d)< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_html_a937503d72b66c661bf3f5fdcd98ef97c" > < div class = "ttname" > < a href = "namespacemlx_1_1core.html#a937503d72b66c661bf3f5fdcd98ef97c" > mlx::core::operator==< / a > < / div > < div class = "ttdeci" > bool operator==(const Device & lhs, const Device & rhs)< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_html_a94d00a1b7f8a4717ab3f26f45e4da655" > < div class = "ttname" > < a href = "namespacemlx_1_1core.html#a94d00a1b7f8a4717ab3f26f45e4da655" > mlx::core::operator!=< / a > < / div > < div class = "ttdeci" > bool operator!=(const Device & lhs, const Device & rhs)< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html" > mlx::core::Device< / a > < / div > < div class = "ttdef" > < b > Definition< / b > device.h:7< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_a45ed081b56ae5d4ddd39c83a5d8a1616" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#a45ed081b56ae5d4ddd39c83a5d8a1616" > mlx::core::Device::gpu< / a > < / div > < div class = "ttdeci" > static constexpr DeviceType gpu< / div > < div class = "ttdef" > < b > Definition< / b > device.h:14< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_a481ccfb94d689994396bd353e966b489" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#a481ccfb94d689994396bd353e966b489" > mlx::core::Device::Device< / a > < / div > < div class = "ttdeci" > Device(DeviceType type, int index=0)< / div > < div class = "ttdef" > < b > Definition< / b > device.h:16< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_a5e345748fe318a267833ab7398b364ac" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#a5e345748fe318a267833ab7398b364ac" > mlx::core::Device::index< / a > < / div > < div class = "ttdeci" > int index< / div > < div class = "ttdef" > < b > Definition< / b > device.h:19< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_a69ee81924251dec96f1945c9d91506fd" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#a69ee81924251dec96f1945c9d91506fd" > mlx::core::Device::cpu< / a > < / div > < div class = "ttdeci" > static constexpr DeviceType cpu< / div > < div class = "ttdef" > < b > Definition< / b > device.h:13< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_a763264ec90f7f23c5dced36c3f0db2e5" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#a763264ec90f7f23c5dced36c3f0db2e5" > mlx::core::Device::type< / a > < / div > < div class = "ttdeci" > DeviceType type< / div > < div class = "ttdef" > < b > Definition< / b > device.h:18< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_ac45b3de9b3458d8f31005136cde20fdb" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdb" > mlx::core::Device::DeviceType< / a > < / div > < div class = "ttdeci" > DeviceType< / div > < div class = "ttdef" > < b > Definition< / b > device.h:8< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_ac45b3de9b3458d8f31005136cde20fdba0aa0be2a866411d9ff03515227454947" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdba0aa0be2a866411d9ff03515227454947" > mlx::core::Device::DeviceType::gpu< / a > < / div > < div class = "ttdeci" > @ gpu< / div > < / div >
< div class = "ttc" id = "astructmlx_1_1core_1_1_device_html_ac45b3de9b3458d8f31005136cde20fdbad9747e2da342bdb995f6389533ad1a3d" > < div class = "ttname" > < a href = "structmlx_1_1core_1_1_device.html#ac45b3de9b3458d8f31005136cde20fdbad9747e2da342bdb995f6389533ad1a3d" > mlx::core::Device::DeviceType::cpu< / a > < / div > < div class = "ttdeci" > @ cpu< / div > < / div >
< / div > <!-- fragment --> < / div > <!-- contents -->
<!-- start footer part -->
< hr class = "footer" / > < address class = "footer" > < small >
Generated by  < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.10.0
< / small > < / address >
< / body >
< / html >