<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Alex,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thank you for your reply and all of your ideas.  You are right that the SXM uses NVLink - I had not thought of that as a potential culprit.  I do not have any
 PCIe GPUs in this cluster, but I may be able to setup a standalone test on an older box.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I have not seen a specific mention from NVIDIA regarding VFIO support for this form factor of the Tesla V100, but there were talks at GTC regarding using Tesla
 cards with VFIO.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Do you know of a better guide you could point me to for getting up and running with VFIO?  I was thinking that it felt like a permissions issue (as I can query
 the device, but not write to it), so it could be an issue with how it had me set up the ACLs…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">That is great to know of that the CentOS 7.4 kernel does support virqfd – from what I had read, it seemed like it should be there, but decided to try upgrading
 the kernel anyway just in case that was the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Alex Williamson [mailto:alex.williamson@redhat.com]
<br>
<b>Sent:</b> Tuesday, May 1, 2018 10:38 AM<br>
<b>To:</b> Andrew Zimmerman <atz@rincon.com><br>
<b>Cc:</b> 'vfio-users@redhat.com' <vfio-users@redhat.com><br>
<b>Subject:</b> Re: [vfio-users] cudaErrorDevicesUnavailalbe using Cuda in KVM using VFIO device passthrough<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On Tue, 1 May 2018 00:37:36 +0000<br>
Andrew Zimmerman <<a href="mailto:atz@rincon.com">atz@rincon.com</a>> wrote:<br>
<br>
> I have a system with 4 Tesla V100-SXM-16GB GPUs in it, and I am<br>
<br>
SXM is the NVLink variant, right? VFIO has no special knowledge or<br>
handling of NVLink and I'd only consider it supported so far as it<br>
behaves similarly to PCIe. A particular concern of NVLink is how the<br>
mesh nature of the interconnect makes use of and enforces IOMMU-based<br>
translations necessary for device isolation and assignment, but we<br>
can't know this because it's proprietary. Does NVIDIA claim that VFIO<br>
device assignment is supported for these GPUs?<br>
<br>
> attempting to pass these devices through to virtual machines run by<br>
> KVM. I am managing the VMs with OpenNebula and I have followed the<br>
> instructions at<br>
> <a href="https://docs.opennebula.org/5.4/deployment/open_cloud_host_setup/pci_passthrough.html">
https://docs.opennebula.org/5.4/deployment/open_cloud_host_setup/pci_passthrough.html</a><br>
> to pass the device through to my VM. I am able to see the device in<br>
> nvidia-smi, watch its power/temperature levels, change the<br>
> persistence mode and compute mode, etc.<br>
<br>
Ugh, official documentation that recommends the vfio-bind script and<br>
manually modifying libvirt's ACL list. I'd be suspicious of any device<br>
assignment support making use of those sorts of instructions.<br>
<br>
> I can query the device to get properties and capabilities, but when I<br>
> try to run a program on it that utilizes the device (beyond<br>
> querying), I receive an error message about the device being<br>
> unavailable. To test, I am using simpleAtopmicIntrinsics out of the<br>
> CUDA Samples. Here is the output I receive:<br>
> <br>
> SimpleAtomicIntrinsics starting...<br>
> <br>
> GPU Device 0: "Tesla V100-SXM2-16GB": with compute capability 7.0<br>
> <br>
> > GPU device has 80 Multi-Processors, SM 7.0 compute capabilities <br>
> <br>
> Cuda error at simpleAtomicIntrinsics.cu:108<br>
> code=46(cudaErrorDevicesUnavailable) "cudaMalloc((void **) &dOData,<br>
> memsize)"<br>
> <br>
> I have tried this with multiple devices (in case there was an issue<br>
> with vfio on the first device) and had the same result on each of<br>
> them.<br>
<br>
Have you tried with a PCIe Tesla?<br>
<br>
> The host OS is CentOS 7.4.1708. I upgraded the kernel to 4.15.15-1<br>
> from the elrepo to ensure that I had support for vfio_virqfd. I am<br>
> running the NVIDIA 390.15 driver and using cuda 9.1<br>
> (cuda-9-1-9.1.85-1.x86_64 rpm).<br>
<br>
vfio_virqfd is just an artifact of OpenNebula's apparent terrible<br>
handling of device assignment. virqfd is there in a RHEL/Centos 7.4<br>
kernel, but it may not be a separate module and it's not necessary to<br>
load it via dracut as indicated in their guide, only to blacklist<br>
nouveau.<br>
<br>
> Does anyone have ideas on what could be causing this or what I could<br>
> try next?<br>
<br>
I think you're in uncharted territory with NVLink based GPUs and not<br>
quite standard device assignment support in your chosen distro. I'd<br>
start with testing whether the test program works with PCIe GPUs to<br>
eliminate the interconnect issue. Thanks,<br>
<br>
Alex<o:p></o:p></p>
</div>
</body>
</html>