RuntimeError: could not create a primitive

username: fabelfroh
cooked: <p>Hi,</p>
<p>I’m new to pytorch and for a student project I’d like to setup a simple convolution for an image which is 26 megapixel. The below code fails with “RuntimeError: could not create a primitive”. When I decrease the size of the ´torch.randn´ the conv2d works as expected. Where is my error? The code is from a larger project SESF_Net on github. I’m just trying to learn and understand.</p>
<pre><code class="lang-auto">import os
import torch
import torch.nn as nn
import torch.nn.functional as f
r_shift_kernel = torch.FloatTensor([[0, 0, 0], [1, 0, 0], [0, 0, 0]]).reshape((1, 1, 3, 3)).repeat(64, 1, 1, 1)
f1 = torch.randn(1,64,4160,6240)
f1_r_shift = f.conv2d(f1, r_shift_kernel, padding=1, groups=64)
</code></pre>
<p>Thanks and best wishes.</p>

username: ptrblck
cooked: <p>I cannot reproduce this issue using the provided code snippet and a source build.<br>
Unfortunately, I also cannot find a lot of references for the mentioned <code>RuntimeError</code>. Could you post the complete stack trace, please?</p>

username: fabelfroh
cooked: <p>The traceback only looks like this:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "demo.py", line 7, in &lt;module&gt;
    f1_r_shift = f.conv2d(f1, r_shift_kernel, padding=1, groups=64)
RuntimeError: could not create a primitive
</code></pre>
<p>This morning, I tested the example on my Laptop successfully (Macbook from 2017 with 16 GB, above code takes 3 hours…). The above code crashes on a Linux computer (cpu-only, no cuda) with a Xeon 12-core and 192 GB RAM… I also reinstalled all python packages and tested python3.7 and 3.9. Running the latest torch and torch-vision versions available in pip. Same error on that machine. Any other way to debug it? I’m a bit clueless.</p>

username: ptrblck
cooked: <p>The only information for this error message I could find was in a PaddlePaddle discussion, where one user pointed to missing AVX instructions on the CPU, which could then raise this issue.<br>
Could your CPU be lacking this instruction set?</p>

username: fabelfroh
cooked: <p>The cpu is a Xeon W-3235. According to the specification the processor should have two AVX-512 instruction units.</p>
<aside class="onebox allowlistedgeneric">
  <header class="source">
      <img src="https://ark.intel.com/etc.clientlibs/settings/wcm/designs/intel/default/resources/favicon-32x32.png" class="site-icon" width="16" height="16">
      <a href="https://ark.intel.com/content/www/us/en/ark/products/193749/intel-xeon-w-3235-processor-19-25m-cache-3-30-ghz.html" target="_blank" rel="noopener nofollow ugc">ark.intel.com</a>
  </header>
  <article class="onebox-body">
    <img src="http://ark.intel.com/inc/images/fusionmobile/intel-logo-blue.png" class="thumbnail onebox-avatar" width="24" height="24">

<h3><a href="https://ark.intel.com/content/www/us/en/ark/products/193749/intel-xeon-w-3235-processor-19-25m-cache-3-30-ghz.html" target="_blank" rel="noopener nofollow ugc">Intel® Xeon® W-3235 Processor (19.25M Cache, 3.30 GHz) Product Specifications</a></h3>

<p>Intel® Xeon® W-3235 Processor (19.25M Cache, 3.30 GHz) quick reference guide including specifications, features, pricing, compatibility, design documentation, ordering codes, spec codes and more.</p>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>The error is only raised when I choose the dimensions of the image quite high. The following would work, but not the larger values above.</p>
<pre><code class="lang-auto">f1 = torch.randn(1,64,2400,3200)
</code></pre>
<p>With large values, f.conv2d crashes later with the meaningless error. Any other way to debug this?</p>

username: ptrblck
cooked: <p>Could you create an issue in <a href="https://github.com/pytorch/pytorch/issues">GitHub</a>, so that we could track and check this error?<br>
It could be a known limitation of specific CPU instructions, but I’m not familiar enough with these CPU backend libs.</p>