diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/index.html b/index.html new file mode 100644 index 00000000..3fb6f617 --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + + + + Redirecting + + + + + Redirecting to latest/... + + diff --git a/latest/404.html b/latest/404.html new file mode 100644 index 00000000..7c76af2f --- /dev/null +++ b/latest/404.html @@ -0,0 +1,482 @@ + + + + + + + + + + + + + + + + + + rules_cuda: Starlark implementation of bazel rules for CUDA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ +

404 - Not found

+ +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/latest/assets/images/favicon.png b/latest/assets/images/favicon.png new file mode 100644 index 00000000..1cf13b9f Binary files /dev/null and b/latest/assets/images/favicon.png differ diff --git a/latest/assets/javascripts/bundle.b425cdc4.min.js b/latest/assets/javascripts/bundle.b425cdc4.min.js new file mode 100644 index 00000000..201e5235 --- /dev/null +++ b/latest/assets/javascripts/bundle.b425cdc4.min.js @@ -0,0 +1,29 @@ +"use strict";(()=>{var Ci=Object.create;var gr=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Hi=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))yr.call(t,r)&&rn(e,r,t[r]);if(Ht)for(var r of Ht(t))nn.call(t,r)&&rn(e,r,t[r]);return e};var on=(e,t)=>{var r={};for(var n in e)yr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ki(t))!yr.call(e,o)&&o!==r&&gr(e,o,{get:()=>t[o],enumerable:!(n=Ri(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Ci(Hi(e)):{},Pi(t||!e||!e.__esModule?gr(r,"default",{value:e,enumerable:!0}):r,e));var sn=Pt((xr,an)=>{(function(e,t){typeof xr=="object"&&typeof an!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(xr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Qe=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Qe]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),Y())}function Y(){document.addEventListener("mousemove",N),document.addEventListener("mousedown",N),document.addEventListener("mouseup",N),document.addEventListener("pointermove",N),document.addEventListener("pointerdown",N),document.addEventListener("pointerup",N),document.addEventListener("touchmove",N),document.addEventListener("touchstart",N),document.addEventListener("touchend",N)}function B(){document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",N),document.removeEventListener("pointermove",N),document.removeEventListener("pointerdown",N),document.removeEventListener("pointerup",N),document.removeEventListener("touchmove",N),document.removeEventListener("touchstart",N),document.removeEventListener("touchend",N)}function N(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,B())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),Y(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var cn=Pt(Er=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(B,N){d.append(N,B)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,Y=!0,B=this;["append","delete","set"].forEach(function(O){var Qe=h[O];h[O]=function(){Qe.apply(h,arguments),v&&(Y=!1,B.search=h.toString(),Y=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var N=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==N&&(N=this.search,Y&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er)});var qr=Pt((Mt,Nr)=>{/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */(function(t,r){typeof Mt=="object"&&typeof Nr=="object"?Nr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Mt=="object"?Mt.ClipboardJS=r():t.ClipboardJS=r()})(Mt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return Ai}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var E=p()(T);return m("cut"),E},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",E=document.createElement("textarea");E.style.fontSize="12pt",E.style.border="0",E.style.padding="0",E.style.margin="0",E.style.position="absolute",E.style[T?"right":"left"]="-9999px";var H=window.pageYOffset||document.documentElement.scrollTop;return E.style.top="".concat(H,"px"),E.setAttribute("readonly",""),E.value=j,E}var Y=function(T,E){var H=v(T);E.container.appendChild(H);var I=p()(H);return m("copy"),H.remove(),I},B=function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},H="";return typeof T=="string"?H=Y(T,E):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?H=Y(T.value,E):(H=p()(T),m("copy")),H},N=B;function O(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(E){return typeof E}:O=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},O(j)}var Qe=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=T.action,H=E===void 0?"copy":E,I=T.container,q=T.target,Me=T.text;if(H!=="copy"&&H!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(H==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(H==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Me)return N(Me,{container:I});if(q)return H==="cut"?h(q):N(q,{container:I})},De=Qe;function $e(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$e=function(E){return typeof E}:$e=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},$e(j)}function Ei(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function tn(j,T){for(var E=0;E0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=$e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var q=this;this.listener=c()(I,"click",function(Me){return q.onClick(Me)})}},{key:"onClick",value:function(I){var q=I.delegateTarget||I.currentTarget,Me=this.action(q)||"copy",kt=De({action:Me,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Me,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return vr("action",I)}},{key:"defaultTarget",value:function(I){var q=vr("target",I);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(I){return vr("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return N(I,q)}},{key:"cut",value:function(I){return h(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof I=="string"?[I]:I,Me=!!document.queryCommandSupported;return q.forEach(function(kt){Me=Me&&!!document.queryCommandSupported(kt)}),Me}}]),E}(a()),Ai=Li},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */var rs=/["'&<>]/;Yo.exports=ns;function ns(e){var t=""+e,r=rs.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof et?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ee=="function"?Ee(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function C(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: +`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ie=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ee(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(C(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=Ee(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{ln(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Sr=Ie.EMPTY;function jt(e){return e instanceof Ie||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function ln(e){C(e)?e():e.unsubscribe()}var Le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Sr:(this.currentObservers=null,a.push(r),new Ie(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new F;return r.source=this,r},t.create=function(r,n){return new xn(r,n)},t}(F);var xn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Sr},t}(x);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Sn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var Oe=new Sn(wn);var M=new F(function(e){return e.complete()});function Vt(e){return e&&C(e.schedule)}function Cr(e){return e[e.length-1]}function Ye(e){return C(Cr(e))?e.pop():void 0}function Te(e){return Vt(Cr(e))?e.pop():void 0}function zt(e,t){return typeof Cr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return C(e==null?void 0:e.then)}function qt(e){return C(e[ft])}function Kt(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=zi();function Gt(e){return C(e==null?void 0:e[Yt])}function Bt(e){return un(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,et(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,et(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,et(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return C(e==null?void 0:e.getReader)}function U(e){if(e instanceof F)return e;if(e!=null){if(qt(e))return Ni(e);if(pt(e))return qi(e);if(Nt(e))return Ki(e);if(Kt(e))return On(e);if(Gt(e))return Qi(e);if(Jt(e))return Yi(e)}throw Qt(e)}function Ni(e){return new F(function(t){var r=e[ft]();if(C(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qi(e){return new F(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?A(function(o,i){return e(o,i,n)}):de,ge(1),r?He(t):Dn(function(){return new Zt}))}}function Vn(){for(var e=[],t=0;t=2,!0))}function pe(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new x}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,Y=function(){p==null||p.unsubscribe(),p=void 0},B=function(){Y(),u=m=void 0,h=v=!1},N=function(){var O=u;B(),O==null||O.unsubscribe()};return y(function(O,Qe){d++,!v&&!h&&Y();var De=m=m!=null?m:r();Qe.add(function(){d--,d===0&&!v&&!h&&(p=$r(N,f))}),De.subscribe(Qe),!u&&d>0&&(u=new rt({next:function($e){return De.next($e)},error:function($e){v=!0,Y(),p=$r(B,o,$e),De.error($e)},complete:function(){h=!0,Y(),p=$r(B,s),De.complete()}}),U(O).subscribe(u))})(c)}}function $r(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function z(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function tr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(ke(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),V(e===_e()),J())}function Xe(e){return{x:e.offsetLeft,y:e.offsetTop}}function Kn(e){return L(b(window,"load"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>Xe(e)),V(Xe(e)))}function rr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>rr(e)),V(rr(e)))}var Yn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!Wr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),va?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ba.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Gn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Jn=typeof WeakMap!="undefined"?new WeakMap:new Yn,Xn=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ga.getInstance(),n=new La(t,r,this);Jn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Xn.prototype[e]=function(){var t;return(t=Jn.get(this))[e].apply(t,arguments)}});var Aa=function(){return typeof nr.ResizeObserver!="undefined"?nr.ResizeObserver:Xn}(),Zn=Aa;var eo=new x,Ca=$(()=>k(new Zn(e=>{for(let t of e)eo.next(t)}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ye(e){return Ca.pipe(S(t=>t.observe(e)),g(t=>eo.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(()=>he(e)))),V(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function ar(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var to=new x,Ra=$(()=>k(new IntersectionObserver(e=>{for(let t of e)to.next(t)},{threshold:0}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function sr(e){return Ra.pipe(S(t=>t.observe(e)),g(t=>to.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function ro(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),J())}var cr={drawer:z("[data-md-toggle=drawer]"),search:z("[data-md-toggle=search]")};function no(e){return cr[e].checked}function Ke(e,t){cr[e].checked!==t&&cr[e].click()}function Ue(e){let t=cr[e];return b(t,"change").pipe(l(()=>t.checked),V(t.checked))}function ka(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ha(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(V(!1))}function oo(){let e=b(window,"keydown").pipe(A(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:no("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),A(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!ka(n,r)}return!0}),pe());return Ha().pipe(g(t=>t?M:e))}function le(){return new URL(location.href)}function ot(e){location.href=e.href}function io(){return new x}function ao(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)ao(e,r)}function _(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)ao(n,o);return n}function fr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function so(){return location.hash.substring(1)}function Dr(e){let t=_("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Pa(e){return L(b(window,"hashchange"),e).pipe(l(so),V(so()),A(t=>t.length>0),X(1))}function co(e){return Pa(e).pipe(l(t=>ce(`[id="${t}"]`)),A(t=>typeof t!="undefined"))}function Vr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(V(t.matches))}function fo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(V(e.matches))}function zr(e,t){return e.pipe(g(r=>r?t():M))}function ur(e,t={credentials:"same-origin"}){return ue(fetch(`${e}`,t)).pipe(fe(()=>M),g(r=>r.status!==200?Ot(()=>new Error(r.statusText)):k(r)))}function We(e,t){return ur(e,t).pipe(g(r=>r.json()),X(1))}function uo(e,t){let r=new DOMParser;return ur(e,t).pipe(g(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),X(1))}function pr(e){let t=_("script",{src:e});return $(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(g(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),R(()=>document.head.removeChild(t)),ge(1))))}function po(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function lo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(po),V(po()))}function mo(){return{width:innerWidth,height:innerHeight}}function ho(){return b(window,"resize",{passive:!0}).pipe(l(mo),V(mo()))}function bo(){return G([lo(),ho()]).pipe(l(([e,t])=>({offset:e,size:t})),X(1))}function lr(e,{viewport$:t,header$:r}){let n=t.pipe(ee("size")),o=G([n,r]).pipe(l(()=>Xe(e)));return G([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Rule Authoring

+ + + +

+

actions.compile

+
+actions.compile(ctx, cuda_toolchain, cc_toolchain, srcs, common, pic, rdc)
+
+ +

Perform CUDA compilation, return compiled object files.

+

Notes:

+
    +
  • If rdc is set to True, then an additional step of device link must be performed.
  • +
  • The rules should call this action only once in case srcs have non-unique basenames, + say foo/kernel.cu and bar/kernel.cu.
  • +
+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctxA context object.none
cuda_toolchainA platform_common.ToolchainInfo of a cuda toolchain, Can be obtained with find_cuda_toolchain(ctx).none
cc_toolchainA CcToolchainInfo. Can be obtained with find_cpp_toolchain(ctx).none
srcsA list of Files to be compiled.none
commonA cuda common object. Can be obtained with cuda_helper.create_common(ctx)none
picWhether the srcs are compiled for position independent code.False
rdcWhether the srcs are compiled for relocatable device code.False
+

RETURNS

+

An compiled object File.

+

+ +
+actions.device_link(ctx, cuda_toolchain, cc_toolchain, objects, common, pic, rdc, dlto)
+
+ +

Perform device link, return a dlink-ed object file.

+

Notes: + Compilation is carried out during device linking, which involves the embeeding of the fatbin into the resulting object File.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctxA context object.none
cuda_toolchainA platform_common.ToolchainInfo of a cuda toolchain, Can be obtained with find_cuda_toolchain(ctx).none
cc_toolchainA CcToolchainInfo. Can be obtained with find_cpp_toolchain(ctx).none
objectsA depset of Files to be device linked.none
commonA cuda common object. Can be obtained with cuda_helper.create_common(ctx)none
picWhether the objects are compiled for position independent code.False
rdcWhether the objects are device linked for relocatable device code.False
dltoWhether the device link time optimization is enabled.False
+

RETURNS

+

An deviced linked object File.

+

+

config_helper.collect_selectables_info

+
+config_helper.collect_selectables_info(selectables)
+
+ +

Constructor of _SelectablesInfo.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
selectablesList of action_configs and/or features.none
+

+

config_helper.is_configured

+
+config_helper.is_configured(selectables_info, name)
+
+ +

Whether an action or a feature exists

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
selectables_infoThe _SelectablesInfo returned from _collect_selectables_infonone
nameName of the selectable, that is, an action_config or a feature.none
+

+

config_helper.configure_features

+ + +

Constructor of _FeatureConfigurationInfo.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
selectablesList of action_configs and/or features.None
selectables_infoThe _SelectablesInfo returned from _collect_selectables_infoNone
requested_featuresList of names of action_configs and/or features to be enabled.None
unsupported_featuresList of names of action_configs and/or features to be disabled.None
_debug

-

False
+

+

config_helper.get_default_features_and_action_configs

+
+config_helper.get_default_features_and_action_configs(info)
+
+ +

Get all default enabled features and action configs.

+

Notes: + For testing purpose. Default enabled maybe disabled after configuration.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
+

+

config_helper.get_enabled_feature

+
+config_helper.get_enabled_feature(info)
+
+ +

Get all enabled features.

+

Notes: + For testing purpose.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
+

+

config_helper.get_command_line

+
+config_helper.get_command_line(info, action, value)
+
+ +

Returns flattened command line flags for given action, using given variables for expansion.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
actionName of the action.none
valueBuild variables to be used for template expansion.none
+

+

config_helper.get_tool_for_action

+
+config_helper.get_tool_for_action(info, action_name)
+
+ +

Returns tool path for given action.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
action_nameName of the action.none
+

+

config_helper.action_is_enabled

+
+config_helper.action_is_enabled(info, name)
+
+ +

Returns whether a selectable is enable or not.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
nameName of the selectable, that is, an action_config or a feature.none
+

+

config_helper.is_enabled

+
+config_helper.is_enabled(info, name)
+
+ +

Returns whether a selectable is enable or not.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
nameName of the selectable, that is, an action_config or a feature.none
+

+

config_helper.get_environment_variables

+
+config_helper.get_environment_variables(info, action, value)
+
+ +

Returns environment variables to be set for the given action.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
actionName of the action.none
valueBuild variables to be used for template expansion.none
+

+

config_helper.get_artifact_name

+
+config_helper.get_artifact_name(artifact_name_patterns, category_name, basename)
+
+ +

Returns artifact_name in form of prefix + basename + extension.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
artifact_name_patternsA list of artifact_name_pattern.none
category_nameA string match the category_name field in artifact_name_pattern.none
basenameA string.none
+

+

cuda_helper.get_arch_specs

+
+cuda_helper.get_arch_specs(specs_str)
+
+ +

Convert string into a list of ArchSpecInfo.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
specs_stra string to be parsed, e.g., "compute_70:sm_70;compute_80:sm_80,sm_86".none
+

RETURNS

+

A list of ArchSpecInfos

+

+

cuda_helper.check_srcs_extensions

+
+cuda_helper.check_srcs_extensions(ctx, allowed_src_files, rule_name)
+
+ +

Ensure ctx.attr.srcs is valid.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctx

-

none
allowed_src_files

-

none
rule_name

-

none
+

+

cuda_helper.check_must_enforce_rdc

+
+cuda_helper.check_must_enforce_rdc(arch_specs, cuda_archs_info)
+
+ +

Force enable rdc if dlto is enabled.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
arch_specs

-

None
cuda_archs_info

-

None
+

+

cuda_helper.get_basename_without_ext

+
+cuda_helper.get_basename_without_ext(basename, allow_exts, fail_if_not_match)
+
+ +

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
basename

-

none
allow_exts

-

none
fail_if_not_match

-

True
+

+

cuda_helper.create_common_info

+ + +

Constructor of the common object.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
cuda_archs_infoCudaArchsInfo.None
includesinclude paths. Can be used with #include <...> and #include "...".[]
quote_includesinclude paths. Can be used with #include "...".[]
system_includesinclude paths. Can be used with #include <...>.[]
headersheaders directly relate with this target.[]
transitive_headersheaders transitively gather from deps.[]
definespublic #defines. Pass to compiler driver directly. Will be seen by downstream targets.[]
local_definesprivate #defines. Pass to compiler driver directly. Will not be seen by downstream targets.[]
compile_flagsflags pass to compiler driver directly.[]
link_flagsflags pass to device linker.[]
host_definespublic #defines. Pass to host compiler. Will be seen by downstream targets.[]
host_local_definesprivate #defines. Pass to host compiler. Will not be seen by downstream targets.[]
host_compile_flagsflags pass to host compiler.[]
host_link_flagsflags pass to host linker.[]
ptxas_flagsflags pass to ptxas.[]
transitive_cc_info

-

None
transitive_linking_contextsCcInfo.linking_context extracted from deps[]
+

+

cuda_helper.create_common

+
+cuda_helper.create_common(ctx)
+
+ +

Helper to gather and process various information from ctx object to ease the parameter passing for internal macros.

+

See cuda_helper.create_common_info what information a common object encapsulates.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctx

-

none
+

+

cuda_helper.create_cuda_info

+
+cuda_helper.create_cuda_info(defines, objects, rdc_objects, pic_objects, rdc_pic_objects)
+
+ +

Constructor for CudaInfo. See the providers documentation for detail.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
defines

-

None
objects

-

None
rdc_objects

-

None
pic_objects

-

None
rdc_pic_objects

-

None
+

+

cuda_helper.get_artifact_category_from_action

+
+cuda_helper.get_artifact_category_from_action(action_name, use_pic, use_rdc)
+
+ +

Query the canonical artifact category name.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
action_name

-

none
use_pic

-

None
use_rdc

-

None
+

+

cuda_helper.get_artifact_name

+
+cuda_helper.get_artifact_name(cuda_toolchain, category_name, output_basename)
+
+ +

Create the artifact name that follow the toolchain configuration.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
cuda_toolchainCUDA toolchain returned by find_cuda_toolchain.none
category_nameThe canonical artifact category name return by cuda_helper.get_artifact_category_from_actionnone
output_basenameThe basename.none
+

+

cuda_helper.create_compile_variables

+ + +

Returns variables used for compile actions.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
cuda_toolchaincuda_toolchain for which we are creating build variables.none
feature_configurationFeature configuration to be queried.none
cuda_archs_infoCudaArchsInfonone
source_filesource file for the compilation.None
output_fileoutput file of the compilation.None
host_compilerhost compiler path.None
compile_flagsflags pass to compiler driver directly.[]
host_compile_flagsflags pass to host compiler.[]
include_pathsinclude paths. Can be used with #include <...> and #include "...".[]
quote_include_pathsinclude paths. Can be used with #include "...".[]
system_include_pathsinclude paths. Can be used with #include <...>.[]
defines#defines. Pass to compiler driver directly.[]
host_defines#defines. Pass to host compiler.[]
ptxas_flagsflags pass to ptxas.[]
use_picwhether to compile for position independent code.False
use_rdcwhether to compile for relocatable device code.False
+

+ + + +

Returns variables used for device_link actions.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
cuda_toolchaincuda_toolchain for which we are creating build variables.none
feature_configurationFeature configuration to be queried.none
cuda_archs_infoCudaArchsInfonone
output_fileoutput file of the device linking.None
host_compilerhost compiler path.None
host_compile_flagsflags pass to host compiler.[]
user_link_flagsflags for device linking.[]
use_picwhether to compile for position independent code.False
+

+

cuda_helper.configure_features

+
+cuda_helper.configure_features(ctx, cuda_toolchain, requested_features, unsupported_features,
+                               _debug)
+
+ +

Creates a feature_configuration instance.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctxThe rule context.none
cuda_toolchaincuda_toolchain for which we configure features.none
requested_featuresList of features to be enabled.None
unsupported_featuresList of features that are unsupported by the current rule.None
_debug

-

False
+

+

cuda_helper.get_command_line

+
+cuda_helper.get_command_line(info, action, value)
+
+ +

Returns flattened command line flags for given action, using given variables for expansion.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
actionName of the action.none
valueBuild variables to be used for template expansion.none
+

+

cuda_helper.get_tool_for_action

+
+cuda_helper.get_tool_for_action(info, action_name)
+
+ +

Returns tool path for given action.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
action_nameName of the action.none
+

+

cuda_helper.action_is_enabled

+
+cuda_helper.action_is_enabled(info, name)
+
+ +

Returns whether a selectable is enable or not.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
nameName of the selectable, that is, an action_config or a feature.none
+

+

cuda_helper.is_enabled

+
+cuda_helper.is_enabled(info, name)
+
+ +

Returns whether a selectable is enable or not.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
nameName of the selectable, that is, an action_config or a feature.none
+

+

cuda_helper.get_environment_variables

+
+cuda_helper.get_environment_variables(info, action, value)
+
+ +

Returns environment variables to be set for the given action.

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
infoA _FeatureConfigurationInfo, returned by configure_features, to be queried.none
actionName of the action.none
valueBuild variables to be used for template expansion.none
+

+

repositories.config_clang

+
+repositories.config_clang(repository_ctx, cuda, clang_path)
+
+ +

Generate @local_cuda//toolchain/clang/BUILD

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
repository_ctxrepository_ctxnone
cudaThe struct returned from detect_cuda_toolkitnone
clang_pathPath to clang executable returned from detect_clangnone
+

+

repositories.config_cuda_toolkit_and_nvcc

+
+repositories.config_cuda_toolkit_and_nvcc(repository_ctx, cuda)
+
+ +

Generate @local_cuda//BUILD and @local_cuda//defs.bzl and @local_cuda//toolchain/BUILD

+

PARAMETERS

+ + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault Value
repository_ctxrepository_ctxnone
cudaThe struct returned from detect_cuda_toolkitnone
+

+

repositories.detect_clang

+
+repositories.detect_clang(repository_ctx)
+
+ +

Detect local clang installation.

+

The path to clang is determined by:

+
    +
  • taken from CUDA_CLANG_PATH environment variable or
  • +
  • taken from BAZEL_LLVM environment variable as $BAZEL_LLVM/bin/clang or
  • +
  • determined through which clang or
  • +
  • treated as being not detected and not configured
  • +
+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
repository_ctxrepository_ctxnone
+

RETURNS

+

clang_path (str | None): Optionally return a string of path to clang executable if detected.

+

+

repositories.detect_cuda_toolkit

+
+repositories.detect_cuda_toolkit(repository_ctx)
+
+ +

Detect CUDA Toolkit.

+

The path to CUDA Toolkit is determined as: + - the value of toolkit_path passed to local_cuda as an attribute + - taken from CUDA_PATH environment variable or + - determined through 'which ptxas' or + - defaults to '/usr/local/cuda'

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
repository_ctxrepository_ctxnone
+

RETURNS

+

A struct contains the information of CUDA Toolkit.

+

+

toolchain.use_cpp_toolchain

+
+toolchain.use_cpp_toolchain(mandatory)
+
+ +

Helper to depend on the C++ toolchain.

+

Notes: + Copied from toolchain_utils.bzl

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
mandatory

-

True
+

+

toolchain.use_cuda_toolchain

+
+toolchain.use_cuda_toolchain()
+
+ +

Helper to depend on the CUDA toolchain.

+

+

toolchain.find_cuda_toolchain

+
+toolchain.find_cuda_toolchain(ctx)
+
+ +

Helper to get the cuda toolchain from context object.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctxThe rule context for which to find a toolchain.none
+

RETURNS

+

A platform_common.ToolchainInfo that wraps around the necessary information of a cuda toolchain.

+

+

toolchain.find_cuda_toolkit

+
+toolchain.find_cuda_toolkit(ctx)
+
+ +

Finds the CUDA toolchain.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
ctxThe rule context for which to find a toolchain.none
+

RETURNS

+

A CudaToolkitInfo.

+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/latest/developer/providers_docs/index.html b/latest/developer/providers_docs/index.html new file mode 100644 index 00000000..9006d8be --- /dev/null +++ b/latest/developer/providers_docs/index.html @@ -0,0 +1,844 @@ + + + + + + + + + + + + + + + + + + + + + + Providers - rules_cuda: Starlark implementation of bazel rules for CUDA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Providers

+ + + +

+

ArchSpecInfo

+
+ArchSpecInfo(stage1_arch, stage2_archs)
+
+ +

Provides the information of how GPU compilation +is carried out of a single virtual architecture.

+

FIELDS

+ + + + + + + + + + + + + + + + + +
NameDescription
stage1_archA virtual architecture, str, arch number only
stage2_archsA list of virtual or gpu architecture, list of Stage2ArchInfo
+

+

CudaArchsInfo

+
+CudaArchsInfo(arch_specs)
+
+ +

Provides a list of CUDA archs to compile for.

+

Read the whole Chapter 5 of CUDA Compiler Driver NVCC Reference Guide +if more detail is needed.

+

FIELDS

+ + + + + + + + + + + + + +
NameDescription
arch_specsA list of ArchSpecInfo
+

+

CudaInfo

+ + +

Provides cuda build artifacts that can be consumed by device linking or linking process.

+

This provider is analog to CcInfo but only contains necessary information for +linking in a flat structure.

+

FIELDS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
definesA depset of strings. It is used for the compilation during device linking.
objectsA depset of objects.
rdc_objectsA depset of relocatable device code objects.
pic_objectsA depset of position indepentent code objects.
rdc_pic_objectsA depset of relocatable device code and position indepentent code objects.
+

+

CudaToolchainConfigInfo

+ + +

Provides the information of what the toolchain is and how the toolchain is configured.

+

FIELDS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
action_configsA list of action_configs.
artifact_name_patternsA list of artifact_name_patterns.
cuda_toolkitCudaToolkitInfo
featuresA list of features.
toolchain_identifiernvcc or clang
+

+

CudaToolkitInfo

+ + +

Provides the information of CUDA Toolkit.

+

FIELDS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
pathstring of path to cuda toolkit root
version_majorint of the cuda toolkit major version, e.g, 11 for 11.6
version_minorint of the cuda toolkit minor version, e.g, 6 for 11.6
nvlinkFile to the nvlink executable
link_stubFile to the link.stub file
bin2cFile to the bin2c executable
fatbinaryFile to the fatbinary executable
+

+

Stage2ArchInfo

+
+Stage2ArchInfo(arch, virtual, gpu, lto)
+
+ +

Provides the information of how the stage 2 complation is carried out.

+

One and only one of virtual, gpu and lto must be set to True. For example, if arch is set to 80 and virtual is True, then a +ptx embedding process is carried out for compute_80. Multiple Stage2ArchInfo can be used for specifying how a stage 1 result is +transformed into its final form.

+

FIELDS

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
archstr, arch number
virtualbool, use virtual arch, default False
gpubool, use gpu arch, default False
ltobool, use lto, default False
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/latest/index.html b/latest/index.html new file mode 100644 index 00000000..f8862601 --- /dev/null +++ b/latest/index.html @@ -0,0 +1,737 @@ + + + + + + + + + + + + + + + + + + + + rules_cuda: Starlark implementation of bazel rules for CUDA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

CUDA rules for Bazel

+

This repository contains Starlark implementation of CUDA rules in Bazel.

+

These rules provide some macros and rules that make it easier to build CUDA with Bazel.

+

Getting Started

+

Add the following to your WORKSPACE file and replace the placeholders with actual values.

+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+http_archive(
+    name = "rules_cuda",
+    sha256 = "{sha256_to_replace}",
+    strip_prefix = "rules_cuda-{git_commit_hash}",
+    urls = ["https://github.com/bazel-contrib/rules_cuda/archive/{git_commit_hash}.tar.gz"],
+)
+load("@rules_cuda//cuda:repositories.bzl", "register_detected_cuda_toolchains", "rules_cuda_dependencies")
+rules_cuda_dependencies()
+register_detected_cuda_toolchains()
+
+

NOTE: the use of register_detected_cuda_toolchains depends on the environment variable CUDA_PATH. You must also +ensure the host compiler is available. On windows, this means that you will also need to set the environment variable +BAZEL_VC properly.

+

detect_cuda_toolkit +and detect_clang +determains how the toolchains are detected.

+

Rules

+
    +
  • cuda_library: Can be used to compile and create static library for CUDA kernel code. The resulting targets can be + consumed by C/C++ Rules.
  • +
  • cuda_objects: If you don't understand what device link means, you must never use it. This rule produce incomplete + object files that can only be consumed by cuda_library. It is created for relocatable device code and device link + time optimization source files.
  • +
+

Flags

+

Some flags are defined in cuda/BUILD.bazel. To use them, for example:

+
bazel build --@rules_cuda//cuda:archs=compute_61:compute_61,sm_61
+
+

In .bazelrc file, you can define shortcut alias for the flag, for example:

+
# Convenient flag shortcuts.
+build --flag_alias=cuda_archs=@rules_cuda//cuda:archs
+
+

and then you can use it as following:

+
bazel build --cuda_archs=compute_61:compute_61,sm_61
+
+

Available flags

+
    +
  • @rules_cuda//cuda:enable
  • +
+

Enable or disable all rules_cuda related rules. When disabled, the detected cuda toolchains will also be disabled to avoid potential human error. + By default, rules_cuda rules are enabled. See examples/if_cuda for how to support both cuda-enabled and cuda-free builds.

+
    +
  • @rules_cuda//cuda:archs
  • +
+

Select the cuda archs to support. See cuda_archs specification DSL grammar.

+
    +
  • @rules_cuda//cuda:compiler
  • +
+

Select the cuda compiler, available options are nvcc or clang

+
    +
  • @rules_cuda//cuda:copts
  • +
+

Add the copts to all cuda compile actions.

+
    +
  • @rules_cuda//cuda:runtime
  • +
+

Set the default cudart to link, for example, --@rules_cuda//cuda:runtime=@local_cuda//:cuda_runtime_static link the static cuda runtime.

+
    +
  • --features=cuda_device_debug
  • +
+

Sets nvcc flags to enable debug information in device code. + Currently ignored for clang, where --compilation_mode=debug applies to both + host and device code.

+

Examples

+

Checkout the examples to see if it fits your needs.

+

See examples for basic usage.

+

See rules_cuda_examples for extended real world projects.

+

Known issue

+

Sometimes the following error occurs:

+
cc1plus: fatal error: /tmp/tmpxft_00000002_00000019-2.cpp: No such file or directory
+
+

The problem is caused by nvcc use PID to determine temporary file name, and with --spawn_strategy linux-sandbox which is the default strategy on Linux, the PIDs nvcc sees are all very small numbers, say 2~4 due to sandboxing. linux-sandbox is not hermetic because it mounts root into the sandbox, thus, /tmp is shared between sandboxes, which is causing name conflict under high parallelism. Similar problem has been reported at nvidia forums.

+

To avoid it:

+
    +
  • Use --spawn_strategy local should eliminate the case because it will let nvcc sees the true PIDs.
  • +
  • Use --experimental_use_hermetic_linux_sandbox should eliminate the case because it will avoid the sharing of /tmp.
  • +
  • Add -objtemp option to the command should reduce the case from happening.
  • +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/latest/search/search_index.json b/latest/search/search_index.json new file mode 100644 index 00000000..4bfeb24a --- /dev/null +++ b/latest/search/search_index.json @@ -0,0 +1 @@ +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"CUDA rules for Bazel","text":"

This repository contains Starlark implementation of CUDA rules in Bazel.

These rules provide some macros and rules that make it easier to build CUDA with Bazel.

"},{"location":"#getting-started","title":"Getting Started","text":"

Add the following to your WORKSPACE file and replace the placeholders with actual values.

load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nhttp_archive(\n    name = \"rules_cuda\",\n    sha256 = \"{sha256_to_replace}\",\n    strip_prefix = \"rules_cuda-{git_commit_hash}\",\n    urls = [\"https://github.com/bazel-contrib/rules_cuda/archive/{git_commit_hash}.tar.gz\"],\n)\nload(\"@rules_cuda//cuda:repositories.bzl\", \"register_detected_cuda_toolchains\", \"rules_cuda_dependencies\")\nrules_cuda_dependencies()\nregister_detected_cuda_toolchains()\n

NOTE: the use of register_detected_cuda_toolchains depends on the environment variable CUDA_PATH. You must also ensure the host compiler is available. On windows, this means that you will also need to set the environment variable BAZEL_VC properly.

detect_cuda_toolkit and detect_clang determains how the toolchains are detected.

"},{"location":"#rules","title":"Rules","text":"
  • cuda_library: Can be used to compile and create static library for CUDA kernel code. The resulting targets can be consumed by C/C++ Rules.
  • cuda_objects: If you don't understand what device link means, you must never use it. This rule produce incomplete object files that can only be consumed by cuda_library. It is created for relocatable device code and device link time optimization source files.
"},{"location":"#flags","title":"Flags","text":"

Some flags are defined in cuda/BUILD.bazel. To use them, for example:

bazel build --@rules_cuda//cuda:archs=compute_61:compute_61,sm_61\n

In .bazelrc file, you can define shortcut alias for the flag, for example:

# Convenient flag shortcuts.\nbuild --flag_alias=cuda_archs=@rules_cuda//cuda:archs\n

and then you can use it as following:

bazel build --cuda_archs=compute_61:compute_61,sm_61\n
"},{"location":"#available-flags","title":"Available flags","text":"
  • @rules_cuda//cuda:enable

Enable or disable all rules_cuda related rules. When disabled, the detected cuda toolchains will also be disabled to avoid potential human error. By default, rules_cuda rules are enabled. See examples/if_cuda for how to support both cuda-enabled and cuda-free builds.

  • @rules_cuda//cuda:archs

Select the cuda archs to support. See cuda_archs specification DSL grammar.

  • @rules_cuda//cuda:compiler

Select the cuda compiler, available options are nvcc or clang

  • @rules_cuda//cuda:copts

Add the copts to all cuda compile actions.

  • @rules_cuda//cuda:runtime

Set the default cudart to link, for example, --@rules_cuda//cuda:runtime=@local_cuda//:cuda_runtime_static link the static cuda runtime.

  • --features=cuda_device_debug

Sets nvcc flags to enable debug information in device code. Currently ignored for clang, where --compilation_mode=debug applies to both host and device code.

"},{"location":"#examples","title":"Examples","text":"

Checkout the examples to see if it fits your needs.

See examples for basic usage.

See rules_cuda_examples for extended real world projects.

"},{"location":"#known-issue","title":"Known issue","text":"

Sometimes the following error occurs:

cc1plus: fatal error: /tmp/tmpxft_00000002_00000019-2.cpp: No such file or directory\n

The problem is caused by nvcc use PID to determine temporary file name, and with --spawn_strategy linux-sandbox which is the default strategy on Linux, the PIDs nvcc sees are all very small numbers, say 2~4 due to sandboxing. linux-sandbox is not hermetic because it mounts root into the sandbox, thus, /tmp is shared between sandboxes, which is causing name conflict under high parallelism. Similar problem has been reported at nvidia forums.

To avoid it:

  • Use --spawn_strategy local should eliminate the case because it will let nvcc sees the true PIDs.
  • Use --experimental_use_hermetic_linux_sandbox should eliminate the case because it will avoid the sharing of /tmp.
  • Add -objtemp option to the command should reduce the case from happening.
"},{"location":"developer/developer_docs/","title":"Rule Authoring","text":""},{"location":"developer/developer_docs/#actionscompile","title":"actions.compile","text":"
\nactions.compile(ctx, cuda_toolchain, cc_toolchain, srcs, common, pic, rdc)\n

Perform CUDA compilation, return compiled object files.

Notes:

  • If rdc is set to True, then an additional step of device link must be performed.
  • The rules should call this action only once in case srcs have non-unique basenames, say foo/kernel.cu and bar/kernel.cu.

PARAMETERS

Name Description Default Value ctx A context object. none cuda_toolchain A platform_common.ToolchainInfo of a cuda toolchain, Can be obtained with find_cuda_toolchain(ctx). none cc_toolchain A CcToolchainInfo. Can be obtained with find_cpp_toolchain(ctx). none srcs A list of Files to be compiled. none common A cuda common object. Can be obtained with cuda_helper.create_common(ctx) none pic Whether the srcs are compiled for position independent code. False rdc Whether the srcs are compiled for relocatable device code. False

RETURNS

An compiled object File.

"},{"location":"developer/developer_docs/#actionsdevice_link","title":"actions.device_link","text":"
\nactions.device_link(ctx, cuda_toolchain, cc_toolchain, objects, common, pic, rdc, dlto)\n

Perform device link, return a dlink-ed object file.

Notes: Compilation is carried out during device linking, which involves the embeeding of the fatbin into the resulting object File.

PARAMETERS

Name Description Default Value ctx A context object. none cuda_toolchain A platform_common.ToolchainInfo of a cuda toolchain, Can be obtained with find_cuda_toolchain(ctx). none cc_toolchain A CcToolchainInfo. Can be obtained with find_cpp_toolchain(ctx). none objects A depset of Files to be device linked. none common A cuda common object. Can be obtained with cuda_helper.create_common(ctx) none pic Whether the objects are compiled for position independent code. False rdc Whether the objects are device linked for relocatable device code. False dlto Whether the device link time optimization is enabled. False

RETURNS

An deviced linked object File.

"},{"location":"developer/developer_docs/#config_helpercollect_selectables_info","title":"config_helper.collect_selectables_info","text":"
\nconfig_helper.collect_selectables_info(selectables)\n

Constructor of _SelectablesInfo.

PARAMETERS

Name Description Default Value selectables List of action_configs and/or features. none

"},{"location":"developer/developer_docs/#config_helperis_configured","title":"config_helper.is_configured","text":"
\nconfig_helper.is_configured(selectables_info, name)\n

Whether an action or a feature exists

PARAMETERS

Name Description Default Value selectables_info The _SelectablesInfo returned from _collect_selectables_info none name Name of the selectable, that is, an action_config or a feature. none

"},{"location":"developer/developer_docs/#config_helperconfigure_features","title":"config_helper.configure_features","text":"
\nconfig_helper.configure_features(selectables, selectables_info, requested_features,\n                                 unsupported_features, _debug)\n

Constructor of _FeatureConfigurationInfo.

PARAMETERS

Name Description Default Value selectables List of action_configs and/or features. None selectables_info The _SelectablesInfo returned from _collect_selectables_info None requested_features List of names of action_configs and/or features to be enabled. None unsupported_features List of names of action_configs and/or features to be disabled. None _debug

-

False

"},{"location":"developer/developer_docs/#config_helperget_default_features_and_action_configs","title":"config_helper.get_default_features_and_action_configs","text":"
\nconfig_helper.get_default_features_and_action_configs(info)\n

Get all default enabled features and action configs.

Notes: For testing purpose. Default enabled maybe disabled after configuration.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none

"},{"location":"developer/developer_docs/#config_helperget_enabled_feature","title":"config_helper.get_enabled_feature","text":"
\nconfig_helper.get_enabled_feature(info)\n

Get all enabled features.

Notes: For testing purpose.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none

"},{"location":"developer/developer_docs/#config_helperget_command_line","title":"config_helper.get_command_line","text":"
\nconfig_helper.get_command_line(info, action, value)\n

Returns flattened command line flags for given action, using given variables for expansion.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action Name of the action. none value Build variables to be used for template expansion. none

"},{"location":"developer/developer_docs/#config_helperget_tool_for_action","title":"config_helper.get_tool_for_action","text":"
\nconfig_helper.get_tool_for_action(info, action_name)\n

Returns tool path for given action.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action_name Name of the action. none

"},{"location":"developer/developer_docs/#config_helperaction_is_enabled","title":"config_helper.action_is_enabled","text":"
\nconfig_helper.action_is_enabled(info, name)\n

Returns whether a selectable is enable or not.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none name Name of the selectable, that is, an action_config or a feature. none

"},{"location":"developer/developer_docs/#config_helperis_enabled","title":"config_helper.is_enabled","text":"
\nconfig_helper.is_enabled(info, name)\n

Returns whether a selectable is enable or not.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none name Name of the selectable, that is, an action_config or a feature. none

"},{"location":"developer/developer_docs/#config_helperget_environment_variables","title":"config_helper.get_environment_variables","text":"
\nconfig_helper.get_environment_variables(info, action, value)\n

Returns environment variables to be set for the given action.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action Name of the action. none value Build variables to be used for template expansion. none

"},{"location":"developer/developer_docs/#config_helperget_artifact_name","title":"config_helper.get_artifact_name","text":"
\nconfig_helper.get_artifact_name(artifact_name_patterns, category_name, basename)\n

Returns artifact_name in form of prefix + basename + extension.

PARAMETERS

Name Description Default Value artifact_name_patterns A list of artifact_name_pattern. none category_name A string match the category_name field in artifact_name_pattern. none basename A string. none

"},{"location":"developer/developer_docs/#cuda_helperget_arch_specs","title":"cuda_helper.get_arch_specs","text":"
\ncuda_helper.get_arch_specs(specs_str)\n

Convert string into a list of ArchSpecInfo.

PARAMETERS

Name Description Default Value specs_str a string to be parsed, e.g., \"compute_70:sm_70;compute_80:sm_80,sm_86\". none

RETURNS

A list of ArchSpecInfos

"},{"location":"developer/developer_docs/#cuda_helpercheck_srcs_extensions","title":"cuda_helper.check_srcs_extensions","text":"
\ncuda_helper.check_srcs_extensions(ctx, allowed_src_files, rule_name)\n

Ensure ctx.attr.srcs is valid.

PARAMETERS

Name Description Default Value ctx

-

none allowed_src_files

-

none rule_name

-

none

"},{"location":"developer/developer_docs/#cuda_helpercheck_must_enforce_rdc","title":"cuda_helper.check_must_enforce_rdc","text":"
\ncuda_helper.check_must_enforce_rdc(arch_specs, cuda_archs_info)\n

Force enable rdc if dlto is enabled.

PARAMETERS

Name Description Default Value arch_specs

-

None cuda_archs_info

-

None

"},{"location":"developer/developer_docs/#cuda_helperget_basename_without_ext","title":"cuda_helper.get_basename_without_ext","text":"
\ncuda_helper.get_basename_without_ext(basename, allow_exts, fail_if_not_match)\n

PARAMETERS

Name Description Default Value basename

-

none allow_exts

-

none fail_if_not_match

-

True

"},{"location":"developer/developer_docs/#cuda_helpercreate_common_info","title":"cuda_helper.create_common_info","text":"
\ncuda_helper.create_common_info(cuda_archs_info, includes, quote_includes, system_includes, headers,\n                               transitive_headers, defines, local_defines, compile_flags, link_flags,\n                               host_defines, host_local_defines, host_compile_flags, host_link_flags,\n                               ptxas_flags, transitive_cc_info, transitive_linking_contexts)\n

Constructor of the common object.

PARAMETERS

Name Description Default Value cuda_archs_info CudaArchsInfo. None includes include paths. Can be used with #include <...> and #include \"...\". [] quote_includes include paths. Can be used with #include \"...\". [] system_includes include paths. Can be used with #include <...>. [] headers headers directly relate with this target. [] transitive_headers headers transitively gather from deps. [] defines public #defines. Pass to compiler driver directly. Will be seen by downstream targets. [] local_defines private #defines. Pass to compiler driver directly. Will not be seen by downstream targets. [] compile_flags flags pass to compiler driver directly. [] link_flags flags pass to device linker. [] host_defines public #defines. Pass to host compiler. Will be seen by downstream targets. [] host_local_defines private #defines. Pass to host compiler. Will not be seen by downstream targets. [] host_compile_flags flags pass to host compiler. [] host_link_flags flags pass to host linker. [] ptxas_flags flags pass to ptxas. [] transitive_cc_info

-

None transitive_linking_contexts CcInfo.linking_context extracted from deps []

"},{"location":"developer/developer_docs/#cuda_helpercreate_common","title":"cuda_helper.create_common","text":"
\ncuda_helper.create_common(ctx)\n

Helper to gather and process various information from ctx object to ease the parameter passing for internal macros.

See cuda_helper.create_common_info what information a common object encapsulates.

PARAMETERS

Name Description Default Value ctx

-

none

"},{"location":"developer/developer_docs/#cuda_helpercreate_cuda_info","title":"cuda_helper.create_cuda_info","text":"
\ncuda_helper.create_cuda_info(defines, objects, rdc_objects, pic_objects, rdc_pic_objects)\n

Constructor for CudaInfo. See the providers documentation for detail.

PARAMETERS

Name Description Default Value defines

-

None objects

-

None rdc_objects

-

None pic_objects

-

None rdc_pic_objects

-

None

"},{"location":"developer/developer_docs/#cuda_helperget_artifact_category_from_action","title":"cuda_helper.get_artifact_category_from_action","text":"
\ncuda_helper.get_artifact_category_from_action(action_name, use_pic, use_rdc)\n

Query the canonical artifact category name.

PARAMETERS

Name Description Default Value action_name

-

none use_pic

-

None use_rdc

-

None

"},{"location":"developer/developer_docs/#cuda_helperget_artifact_name","title":"cuda_helper.get_artifact_name","text":"
\ncuda_helper.get_artifact_name(cuda_toolchain, category_name, output_basename)\n

Create the artifact name that follow the toolchain configuration.

PARAMETERS

Name Description Default Value cuda_toolchain CUDA toolchain returned by find_cuda_toolchain. none category_name The canonical artifact category name return by cuda_helper.get_artifact_category_from_action none output_basename The basename. none

"},{"location":"developer/developer_docs/#cuda_helpercreate_compile_variables","title":"cuda_helper.create_compile_variables","text":"
\ncuda_helper.create_compile_variables(cuda_toolchain, feature_configuration, cuda_archs_info,\n                                     source_file, output_file, host_compiler, compile_flags,\n                                     host_compile_flags, include_paths, quote_include_paths,\n                                     system_include_paths, defines, host_defines, ptxas_flags,\n                                     use_pic, use_rdc)\n

Returns variables used for compile actions.

PARAMETERS

Name Description Default Value cuda_toolchain cuda_toolchain for which we are creating build variables. none feature_configuration Feature configuration to be queried. none cuda_archs_info CudaArchsInfo none source_file source file for the compilation. None output_file output file of the compilation. None host_compiler host compiler path. None compile_flags flags pass to compiler driver directly. [] host_compile_flags flags pass to host compiler. [] include_paths include paths. Can be used with #include <...> and #include \"...\". [] quote_include_paths include paths. Can be used with #include \"...\". [] system_include_paths include paths. Can be used with #include <...>. [] defines #defines. Pass to compiler driver directly. [] host_defines #defines. Pass to host compiler. [] ptxas_flags flags pass to ptxas. [] use_pic whether to compile for position independent code. False use_rdc whether to compile for relocatable device code. False

"},{"location":"developer/developer_docs/#cuda_helpercreate_device_link_variables","title":"cuda_helper.create_device_link_variables","text":"
\ncuda_helper.create_device_link_variables(cuda_toolchain, feature_configuration, cuda_archs_info,\n                                         output_file, host_compiler, host_compile_flags,\n                                         user_link_flags, use_pic)\n

Returns variables used for device_link actions.

PARAMETERS

Name Description Default Value cuda_toolchain cuda_toolchain for which we are creating build variables. none feature_configuration Feature configuration to be queried. none cuda_archs_info CudaArchsInfo none output_file output file of the device linking. None host_compiler host compiler path. None host_compile_flags flags pass to host compiler. [] user_link_flags flags for device linking. [] use_pic whether to compile for position independent code. False

"},{"location":"developer/developer_docs/#cuda_helperconfigure_features","title":"cuda_helper.configure_features","text":"
\ncuda_helper.configure_features(ctx, cuda_toolchain, requested_features, unsupported_features,\n                               _debug)\n

Creates a feature_configuration instance.

PARAMETERS

Name Description Default Value ctx The rule context. none cuda_toolchain cuda_toolchain for which we configure features. none requested_features List of features to be enabled. None unsupported_features List of features that are unsupported by the current rule. None _debug

-

False

"},{"location":"developer/developer_docs/#cuda_helperget_command_line","title":"cuda_helper.get_command_line","text":"
\ncuda_helper.get_command_line(info, action, value)\n

Returns flattened command line flags for given action, using given variables for expansion.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action Name of the action. none value Build variables to be used for template expansion. none

"},{"location":"developer/developer_docs/#cuda_helperget_tool_for_action","title":"cuda_helper.get_tool_for_action","text":"
\ncuda_helper.get_tool_for_action(info, action_name)\n

Returns tool path for given action.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action_name Name of the action. none

"},{"location":"developer/developer_docs/#cuda_helperaction_is_enabled","title":"cuda_helper.action_is_enabled","text":"
\ncuda_helper.action_is_enabled(info, name)\n

Returns whether a selectable is enable or not.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none name Name of the selectable, that is, an action_config or a feature. none

"},{"location":"developer/developer_docs/#cuda_helperis_enabled","title":"cuda_helper.is_enabled","text":"
\ncuda_helper.is_enabled(info, name)\n

Returns whether a selectable is enable or not.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none name Name of the selectable, that is, an action_config or a feature. none

"},{"location":"developer/developer_docs/#cuda_helperget_environment_variables","title":"cuda_helper.get_environment_variables","text":"
\ncuda_helper.get_environment_variables(info, action, value)\n

Returns environment variables to be set for the given action.

PARAMETERS

Name Description Default Value info A _FeatureConfigurationInfo, returned by configure_features, to be queried. none action Name of the action. none value Build variables to be used for template expansion. none

"},{"location":"developer/developer_docs/#repositoriesconfig_clang","title":"repositories.config_clang","text":"
\nrepositories.config_clang(repository_ctx, cuda, clang_path)\n

Generate @local_cuda//toolchain/clang/BUILD

PARAMETERS

Name Description Default Value repository_ctx repository_ctx none cuda The struct returned from detect_cuda_toolkit none clang_path Path to clang executable returned from detect_clang none

"},{"location":"developer/developer_docs/#repositoriesconfig_cuda_toolkit_and_nvcc","title":"repositories.config_cuda_toolkit_and_nvcc","text":"
\nrepositories.config_cuda_toolkit_and_nvcc(repository_ctx, cuda)\n

Generate @local_cuda//BUILD and @local_cuda//defs.bzl and @local_cuda//toolchain/BUILD

PARAMETERS

Name Description Default Value repository_ctx repository_ctx none cuda The struct returned from detect_cuda_toolkit none

"},{"location":"developer/developer_docs/#repositoriesdetect_clang","title":"repositories.detect_clang","text":"
\nrepositories.detect_clang(repository_ctx)\n

Detect local clang installation.

The path to clang is determined by:

  • taken from CUDA_CLANG_PATH environment variable or
  • taken from BAZEL_LLVM environment variable as $BAZEL_LLVM/bin/clang or
  • determined through which clang or
  • treated as being not detected and not configured

PARAMETERS

Name Description Default Value repository_ctx repository_ctx none

RETURNS

clang_path (str | None): Optionally return a string of path to clang executable if detected.

"},{"location":"developer/developer_docs/#repositoriesdetect_cuda_toolkit","title":"repositories.detect_cuda_toolkit","text":"
\nrepositories.detect_cuda_toolkit(repository_ctx)\n

Detect CUDA Toolkit.

The path to CUDA Toolkit is determined as: - the value of toolkit_path passed to local_cuda as an attribute - taken from CUDA_PATH environment variable or - determined through 'which ptxas' or - defaults to '/usr/local/cuda'

PARAMETERS

Name Description Default Value repository_ctx repository_ctx none

RETURNS

A struct contains the information of CUDA Toolkit.

"},{"location":"developer/developer_docs/#toolchainuse_cpp_toolchain","title":"toolchain.use_cpp_toolchain","text":"
\ntoolchain.use_cpp_toolchain(mandatory)\n

Helper to depend on the C++ toolchain.

Notes: Copied from toolchain_utils.bzl

PARAMETERS

Name Description Default Value mandatory

-

True

"},{"location":"developer/developer_docs/#toolchainuse_cuda_toolchain","title":"toolchain.use_cuda_toolchain","text":"
\ntoolchain.use_cuda_toolchain()\n

Helper to depend on the CUDA toolchain.

"},{"location":"developer/developer_docs/#toolchainfind_cuda_toolchain","title":"toolchain.find_cuda_toolchain","text":"
\ntoolchain.find_cuda_toolchain(ctx)\n

Helper to get the cuda toolchain from context object.

PARAMETERS

Name Description Default Value ctx The rule context for which to find a toolchain. none

RETURNS

A platform_common.ToolchainInfo that wraps around the necessary information of a cuda toolchain.

"},{"location":"developer/developer_docs/#toolchainfind_cuda_toolkit","title":"toolchain.find_cuda_toolkit","text":"
\ntoolchain.find_cuda_toolkit(ctx)\n

Finds the CUDA toolchain.

PARAMETERS

Name Description Default Value ctx The rule context for which to find a toolchain. none

RETURNS

A CudaToolkitInfo.

"},{"location":"developer/providers_docs/","title":"Providers","text":""},{"location":"developer/providers_docs/#archspecinfo","title":"ArchSpecInfo","text":"
\nArchSpecInfo(stage1_arch, stage2_archs)\n

Provides the information of how GPU compilation is carried out of a single virtual architecture.

FIELDS

Name Description stage1_arch A virtual architecture, str, arch number only stage2_archs A list of virtual or gpu architecture, list of Stage2ArchInfo

"},{"location":"developer/providers_docs/#cudaarchsinfo","title":"CudaArchsInfo","text":"
\nCudaArchsInfo(arch_specs)\n

Provides a list of CUDA archs to compile for.

Read the whole Chapter 5 of CUDA Compiler Driver NVCC Reference Guide if more detail is needed.

FIELDS

Name Description arch_specs A list of ArchSpecInfo

"},{"location":"developer/providers_docs/#cudainfo","title":"CudaInfo","text":"
\nCudaInfo(defines, objects, rdc_objects, pic_objects, rdc_pic_objects)\n

Provides cuda build artifacts that can be consumed by device linking or linking process.

This provider is analog to CcInfo but only contains necessary information for linking in a flat structure.

FIELDS

Name Description defines A depset of strings. It is used for the compilation during device linking. objects A depset of objects. rdc_objects A depset of relocatable device code objects. pic_objects A depset of position indepentent code objects. rdc_pic_objects A depset of relocatable device code and position indepentent code objects.

"},{"location":"developer/providers_docs/#cudatoolchainconfiginfo","title":"CudaToolchainConfigInfo","text":"
\nCudaToolchainConfigInfo(action_configs, artifact_name_patterns, cuda_toolkit, features,\n                        toolchain_identifier)\n

Provides the information of what the toolchain is and how the toolchain is configured.

FIELDS

Name Description action_configs A list of action_configs. artifact_name_patterns A list of artifact_name_patterns. cuda_toolkit CudaToolkitInfo features A list of features. toolchain_identifier nvcc or clang

"},{"location":"developer/providers_docs/#cudatoolkitinfo","title":"CudaToolkitInfo","text":"
\nCudaToolkitInfo(path, version_major, version_minor, nvlink, link_stub, bin2c, fatbinary)\n

Provides the information of CUDA Toolkit.

FIELDS

Name Description path string of path to cuda toolkit root version_major int of the cuda toolkit major version, e.g, 11 for 11.6 version_minor int of the cuda toolkit minor version, e.g, 6 for 11.6 nvlink File to the nvlink executable link_stub File to the link.stub file bin2c File to the bin2c executable fatbinary File to the fatbinary executable

"},{"location":"developer/providers_docs/#stage2archinfo","title":"Stage2ArchInfo","text":"
\nStage2ArchInfo(arch, virtual, gpu, lto)\n

Provides the information of how the stage 2 complation is carried out.

One and only one of virtual, gpu and lto must be set to True. For example, if arch is set to 80 and virtual is True, then a ptx embedding process is carried out for compute_80. Multiple Stage2ArchInfo can be used for specifying how a stage 1 result is transformed into its final form.

FIELDS

Name Description arch str, arch number virtual bool, use virtual arch, default False gpu bool, use gpu arch, default False lto bool, use lto, default False"},{"location":"user/toolchain_config_docs/","title":"Configure the toolchain","text":""},{"location":"user/toolchain_config_docs/#cuda_toolchain","title":"cuda_toolchain","text":"
\ncuda_toolchain(name, compiler_executable, compiler_files, toolchain_config)\n

This rule consumes a CudaToolchainConfigInfo and provides a platform_common.ToolchainInfo, a.k.a, the CUDA Toolchain.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required compiler_executable The path of the main executable of this toolchain. String required compiler_files The set of files that are needed when compiling using this toolchain. Label optional None toolchain_config A target that provides a CudaToolchainConfigInfo. Label required

"},{"location":"user/toolchain_config_docs/#cuda_toolchain_config_clang","title":"cuda_toolchain_config_clang","text":"
\ncuda_toolchain_config_clang(name, cuda_toolkit, toolchain_identifier)\n

This rule provides the predefined cuda toolchain configuration for Clang.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required cuda_toolkit A target that provides a CudaToolkitInfo. Label required toolchain_identifier - String required

"},{"location":"user/toolchain_config_docs/#cuda_toolchain_config_nvcc","title":"cuda_toolchain_config_nvcc","text":"
\ncuda_toolchain_config_nvcc(name, cuda_toolkit, nvcc_version_major, nvcc_version_minor,\n                           toolchain_identifier)\n

This rule provides the predefined cuda toolchain configuration for NVCC with non MSVC as host compiler.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required cuda_toolkit A target that provides a CudaToolkitInfo. Label required nvcc_version_major The CUDA Toolkit major version, e.g, 11 for 11.6 Integer optional 0 nvcc_version_minor The CUDA Toolkit minor version, e.g, 6 for 11.6 Integer optional 0 toolchain_identifier - String required

"},{"location":"user/toolchain_config_docs/#cuda_toolchain_config_nvcc_msvc","title":"cuda_toolchain_config_nvcc_msvc","text":"
\ncuda_toolchain_config_nvcc_msvc(name, cuda_toolkit, msvc_env_tmp, nvcc_version_major,\n                                nvcc_version_minor, toolchain_identifier)\n

This rule provides the predefined cuda toolchain configuration for NVCC with MSVC as host compiler.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required cuda_toolkit A target that provides a CudaToolkitInfo. Label required msvc_env_tmp The TEMP directory. String optional \"\" nvcc_version_major The CUDA Toolkit major version, e.g, 11 for 11.6 Integer optional 0 nvcc_version_minor The CUDA Toolkit minor version, e.g, 6 for 11.6 Integer optional 0 toolchain_identifier - String required

"},{"location":"user/toolchain_config_docs/#cuda_toolkit","title":"cuda_toolkit","text":"
\ncuda_toolkit(name, bin2c, fatbinary, link_stub, nvlink, path, version)\n

This rule provides CudaToolkitInfo.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required bin2c The bin2c executable. Label optional None fatbinary The fatbinary executable. Label optional None link_stub The link.stub text file. Label optional None nvlink The nvlink executable. Label optional None path Root path to the CUDA Toolkit. String required version Version of the CUDA Toolkit. String required"},{"location":"user/user_docs/","title":"Using the rules","text":""},{"location":"user/user_docs/#cuda_archs","title":"cuda_archs","text":"
\ncuda_archs(name)\n

A build setting for specifying cuda archs to compile for.

To retain the flexiblity of NVCC, the extended notation is adopted.

When passing cuda_archs from commandline, its spec grammar is as follows:

ARCH_SPECS   ::= ARCH_SPEC [ ';' ARCH_SPECS ]\nARCH_SPEC    ::= [ VIRTUAL_ARCH ':' ] GPU_ARCHS\nGPU_ARCHS    ::= GPU_ARCH [ ',' GPU_ARCHS ]\nGPU_ARCH     ::= 'sm_' ARCH_NUMBER\n               | 'lto_' ARCH_NUMBER\n               | VIRTUAL_ARCH\nVIRTUAL_ARCH ::= 'compute_' ARCH_NUMBER\n               | 'lto_' ARCH_NUMBER\nARCH_NUMBER  ::= (a string in predefined cuda_archs list)\n

E.g.:

  • compute_80:sm_80,sm_86: Use compute_80 PTX, generate cubin with sm_80 and sm_86, no PTX embedded
  • compute_80:compute_80,sm_80,sm_86: Use compute_80 PTX, generate cubin with sm_80 and sm_86, PTX embedded
  • compute_80:compute_80: Embed compute_80 PTX, fully relay on ptxas
  • sm_80,sm_86: Same as compute_80:sm_80,sm_86, the arch with minimum integer value will be automatically populated.
  • sm_80;sm_86: Two specs used.
  • compute_80: Same as compute_80:compute_80

Best Practices:

  • Library supports a full range of archs from xx to yy, you should embed the yy PTX
  • Library supports a sparse range of archs from xx to yy, you should embed the xx PTX

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required

"},{"location":"user/user_docs/#cuda_library","title":"cuda_library","text":"
\ncuda_library(name, alwayslink, copts, defines, deps, hdrs, host_copts, host_defines, host_linkopts,\n             host_local_defines, includes, linkopts, local_defines, ptxasopts, rdc, srcs)\n

This rule compiles and creates static library for CUDA kernel code. The resulting targets can then be consumed by C/C++ Rules.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required alwayslink - Boolean optional False copts Add these options to the CUDA device compilation command. List of strings optional [] defines List of defines to add to the compile line. List of strings optional [] deps - List of labels optional [] hdrs - List of labels optional [] host_copts Add these options to the CUDA host compilation command. List of strings optional [] host_defines List of defines to add to the compile line. List of strings optional [] host_linkopts Add these flags to the host library link command. List of strings optional [] host_local_defines List of defines to add to the compile line, but only apply to this rule. List of strings optional [] includes List of include dirs to be added to the compile line. List of strings optional [] linkopts Add these flags to the CUDA device link command. List of strings optional [] local_defines List of defines to add to the compile line, but only apply to this rule. List of strings optional [] ptxasopts Add these flags to the ptxas command. List of strings optional [] rdc whether to perform relocateable device code linking, otherwise, normal device link. Boolean optional False srcs - List of labels optional []

"},{"location":"user/user_docs/#cuda_objects","title":"cuda_objects","text":"
\ncuda_objects(name, copts, defines, deps, hdrs, host_copts, host_defines, host_local_defines,\n             includes, local_defines, ptxasopts, srcs)\n

This rule produces incomplete object files that can only be consumed by cuda_library. It is created for relocatable device code and device link time optimization source files.

ATTRIBUTES

Name Description Type Mandatory Default name A unique name for this target. Name required copts Add these options to the CUDA device compilation command. List of strings optional [] defines List of defines to add to the compile line. List of strings optional [] deps - List of labels optional [] hdrs - List of labels optional [] host_copts Add these options to the CUDA host compilation command. List of strings optional [] host_defines List of defines to add to the compile line. List of strings optional [] host_local_defines List of defines to add to the compile line, but only apply to this rule. List of strings optional [] includes List of include dirs to be added to the compile line. List of strings optional [] local_defines List of defines to add to the compile line, but only apply to this rule. List of strings optional [] ptxasopts Add these flags to the ptxas command. List of strings optional [] srcs - List of labels optional []

"},{"location":"user/user_docs/#register_detected_cuda_toolchains","title":"register_detected_cuda_toolchains","text":"
\nregister_detected_cuda_toolchains()\n

Helper to register the automatically detected CUDA toolchain(s).

User can setup their own toolchain if needed and ignore the detected ones by not calling this macro.

"},{"location":"user/user_docs/#rules_cuda_dependencies","title":"rules_cuda_dependencies","text":"
\nrules_cuda_dependencies(toolkit_path)\n

Populate the dependencies for rules_cuda. This will setup workspace dependencies (other bazel rules) and local toolchains.

PARAMETERS

Name Description Default Value toolkit_path Optionally specify the path to CUDA toolkit. If not specified, it will be detected automatically. None"}]} \ No newline at end of file diff --git a/latest/sitemap.xml b/latest/sitemap.xml new file mode 100644 index 00000000..0f8724ef --- /dev/null +++ b/latest/sitemap.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/latest/sitemap.xml.gz b/latest/sitemap.xml.gz new file mode 100644 index 00000000..e5ce84de Binary files /dev/null and b/latest/sitemap.xml.gz differ diff --git a/latest/stylesheets/extra.css b/latest/stylesheets/extra.css new file mode 100644 index 00000000..ced394ba --- /dev/null +++ b/latest/stylesheets/extra.css @@ -0,0 +1,20 @@ +.md-header { + background: #44a147; +} + +.stardoc-pre { + height: fit-content; + width: inherit; + overflow: auto; + scrollbar-width: thin; + font-size: 0.8em; +} + +.stardoc-pre::-webkit-scrollbar { + height: 0.25em; + width: 0.25em; +} + +.stardoc-pre::-webkit-scrollbar-thumb { + background-color: var(--md-default-fg-color--lighter); +} diff --git a/latest/user/toolchain_config_docs/index.html b/latest/user/toolchain_config_docs/index.html new file mode 100644 index 00000000..3f9564fb --- /dev/null +++ b/latest/user/toolchain_config_docs/index.html @@ -0,0 +1,899 @@ + + + + + + + + + + + + + + + + + + + + + + Configure the toolchain - rules_cuda: Starlark implementation of bazel rules for CUDA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Configure the toolchain

+ + + +

+

cuda_toolchain

+ + +

This rule consumes a CudaToolchainConfigInfo and provides a platform_common.ToolchainInfo, a.k.a, the CUDA Toolchain.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
compiler_executableThe path of the main executable of this toolchain.Stringrequired
compiler_filesThe set of files that are needed when compiling using this toolchain.LabeloptionalNone
toolchain_configA target that provides a CudaToolchainConfigInfo.Labelrequired
+

+

cuda_toolchain_config_clang

+
+cuda_toolchain_config_clang(name, cuda_toolkit, toolchain_identifier)
+
+ +

This rule provides the predefined cuda toolchain configuration for Clang.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
cuda_toolkitA target that provides a CudaToolkitInfo.Labelrequired
toolchain_identifier-Stringrequired
+

+

cuda_toolchain_config_nvcc

+ + +

This rule provides the predefined cuda toolchain configuration for NVCC with non MSVC as host compiler.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
cuda_toolkitA target that provides a CudaToolkitInfo.Labelrequired
nvcc_version_majorThe CUDA Toolkit major version, e.g, 11 for 11.6Integeroptional0
nvcc_version_minorThe CUDA Toolkit minor version, e.g, 6 for 11.6Integeroptional0
toolchain_identifier-Stringrequired
+

+

cuda_toolchain_config_nvcc_msvc

+ + +

This rule provides the predefined cuda toolchain configuration for NVCC with MSVC as host compiler.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
cuda_toolkitA target that provides a CudaToolkitInfo.Labelrequired
msvc_env_tmpThe TEMP directory.Stringoptional""
nvcc_version_majorThe CUDA Toolkit major version, e.g, 11 for 11.6Integeroptional0
nvcc_version_minorThe CUDA Toolkit minor version, e.g, 6 for 11.6Integeroptional0
toolchain_identifier-Stringrequired
+

+

cuda_toolkit

+ + +

This rule provides CudaToolkitInfo.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
bin2cThe bin2c executable.LabeloptionalNone
fatbinaryThe fatbinary executable.LabeloptionalNone
link_stubThe link.stub text file.LabeloptionalNone
nvlinkThe nvlink executable.LabeloptionalNone
pathRoot path to the CUDA Toolkit.Stringrequired
versionVersion of the CUDA Toolkit.Stringrequired
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/latest/user/user_docs/index.html b/latest/user/user_docs/index.html new file mode 100644 index 00000000..6375be5f --- /dev/null +++ b/latest/user/user_docs/index.html @@ -0,0 +1,951 @@ + + + + + + + + + + + + + + + + + + + + + + Using the rules - rules_cuda: Starlark implementation of bazel rules for CUDA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Using the rules

+ + + +

+

cuda_archs

+
+cuda_archs(name)
+
+ +

A build setting for specifying cuda archs to compile for.

+

To retain the flexiblity of NVCC, the extended notation is adopted.

+

When passing cuda_archs from commandline, its spec grammar is as follows:

+
ARCH_SPECS   ::= ARCH_SPEC [ ';' ARCH_SPECS ]
+ARCH_SPEC    ::= [ VIRTUAL_ARCH ':' ] GPU_ARCHS
+GPU_ARCHS    ::= GPU_ARCH [ ',' GPU_ARCHS ]
+GPU_ARCH     ::= 'sm_' ARCH_NUMBER
+               | 'lto_' ARCH_NUMBER
+               | VIRTUAL_ARCH
+VIRTUAL_ARCH ::= 'compute_' ARCH_NUMBER
+               | 'lto_' ARCH_NUMBER
+ARCH_NUMBER  ::= (a string in predefined cuda_archs list)
+
+

E.g.:

+
    +
  • compute_80:sm_80,sm_86: + Use compute_80 PTX, generate cubin with sm_80 and sm_86, no PTX embedded
  • +
  • compute_80:compute_80,sm_80,sm_86: + Use compute_80 PTX, generate cubin with sm_80 and sm_86, PTX embedded
  • +
  • compute_80:compute_80: + Embed compute_80 PTX, fully relay on ptxas
  • +
  • sm_80,sm_86: + Same as compute_80:sm_80,sm_86, the arch with minimum integer value will be automatically populated.
  • +
  • sm_80;sm_86: + Two specs used.
  • +
  • compute_80: + Same as compute_80:compute_80
  • +
+

Best Practices:

+
    +
  • Library supports a full range of archs from xx to yy, you should embed the yy PTX
  • +
  • Library supports a sparse range of archs from xx to yy, you should embed the xx PTX
  • +
+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
+

+

cuda_library

+ + +

This rule compiles and creates static library for CUDA kernel code. The resulting targets can then be consumed by +C/C++ Rules.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
alwayslink-BooleanoptionalFalse
coptsAdd these options to the CUDA device compilation command.List of stringsoptional[]
definesList of defines to add to the compile line.List of stringsoptional[]
deps-List of labelsoptional[]
hdrs-List of labelsoptional[]
host_coptsAdd these options to the CUDA host compilation command.List of stringsoptional[]
host_definesList of defines to add to the compile line.List of stringsoptional[]
host_linkoptsAdd these flags to the host library link command.List of stringsoptional[]
host_local_definesList of defines to add to the compile line, but only apply to this rule.List of stringsoptional[]
includesList of include dirs to be added to the compile line.List of stringsoptional[]
linkoptsAdd these flags to the CUDA device link command.List of stringsoptional[]
local_definesList of defines to add to the compile line, but only apply to this rule.List of stringsoptional[]
ptxasoptsAdd these flags to the ptxas command.List of stringsoptional[]
rdcwhether to perform relocateable device code linking, otherwise, normal device link.BooleanoptionalFalse
srcs-List of labelsoptional[]
+

+

cuda_objects

+ + +

This rule produces incomplete object files that can only be consumed by cuda_library. It is created for relocatable device +code and device link time optimization source files.

+

ATTRIBUTES

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
coptsAdd these options to the CUDA device compilation command.List of stringsoptional[]
definesList of defines to add to the compile line.List of stringsoptional[]
deps-List of labelsoptional[]
hdrs-List of labelsoptional[]
host_coptsAdd these options to the CUDA host compilation command.List of stringsoptional[]
host_definesList of defines to add to the compile line.List of stringsoptional[]
host_local_definesList of defines to add to the compile line, but only apply to this rule.List of stringsoptional[]
includesList of include dirs to be added to the compile line.List of stringsoptional[]
local_definesList of defines to add to the compile line, but only apply to this rule.List of stringsoptional[]
ptxasoptsAdd these flags to the ptxas command.List of stringsoptional[]
srcs-List of labelsoptional[]
+

+

register_detected_cuda_toolchains

+
+register_detected_cuda_toolchains()
+
+ +

Helper to register the automatically detected CUDA toolchain(s).

+

User can setup their own toolchain if needed and ignore the detected ones by not calling this macro.

+

+

rules_cuda_dependencies

+
+rules_cuda_dependencies(toolkit_path)
+
+ +

Populate the dependencies for rules_cuda. This will setup workspace dependencies (other bazel rules) and local toolchains.

+

PARAMETERS

+ + + + + + + + + + + + + + + +
NameDescriptionDefault Value
toolkit_pathOptionally specify the path to CUDA toolkit. If not specified, it will be detected automatically.None
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..54f8cb38 --- /dev/null +++ b/versions.json @@ -0,0 +1 @@ +[{"version": "latest", "title": "latest", "aliases": []}] \ No newline at end of file