title: How to use all NUMA nodes with openMP on Windows 10
body: <p>I have access to a dual-socket system consisting of two NUMA nodes to do some data processing.</p>
  
  <p>My code is relatively straightforward and I'm using openMP for a main parallelizable loop that looks like this (<em>k</em> is a function parameter and <em>buffer</em> is a multi-gigabytes array of length <em>n</em>):</p>
  
  <pre><code>uint64_t m=0;
  uint64_t *rk = (uint64_t *) calloc(k, sizeof(uint64_t));
  #pragma omp parallel
  {
      #pragma omp for reduction(+:m), reduction(+:rk[:k])
      for (uint64_t i=0; i&lt;n-k; i++)
      {
          m += (uint64_t)buffer[i];
          for (uint64_t j=0; j&lt;k; j++)
          {
              rk[j] += (uint64_t)buffer[i]*(uint64_t)buffer[i+j];
          }
      }
      /* Other stuff, serial and parallel */
  }
  </code></pre>
  
  <p>Under Linux Mint I can compile with gcc without problem and all of the cores on both sockets are put to good use. However, on Windows (mingw-gcc on cygwin) only a single NUMA node is used. Since my code isn't really sensitive to the memory latency, I get 2x slowdown on Windows. </p>
  
  <p>I can't figure out how to force Windows to spread the threads on both nodes. As far as I understand, openMP doesn't support affinity on Windows (cygwin mingw-gcc implementation anyways), but I don't know how I should do it manually.</p>
  
  <p>Any help is greatly appreciated!</p>