parrt / tensor-sensor

The goal of this library is to generate more helpful exception messages for matrix algebra expressions for numpy, pytorch, jax, tensorflow, keras, fastai.
https://github.com/parrt/tensor-sensor
MIT License
771 stars 39 forks source link

Window Support? #4

Closed noklam closed 3 years ago

noklam commented 3 years ago

Can this library run on Window? I am getting this error when I use a notebook to run example

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_L IB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/. [I 11:04:32.509 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports kernel 7aec0344-7569-4f1d-bb6e-7cdd592802b5 restarted

noklam commented 3 years ago

I found a solution, adding this block will work on Window

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

Solution found here: https://github.com/dmlc/xgboost/issues/1715

parrt commented 3 years ago

Hi @noklam you want to get credit for this by creating another PR? It shouldn't affect anything to set that environment variable on Mac etc... right?

noklam commented 3 years ago

@parrt I have googled around and seems people mostly report this error on Window / Mac. I only have Windows and Linux machines, I only tested it on them.