Minmax confusion on VS2022 & build

Okay my problem is since pytorch 2.1 before the were no problem . Since then all max(…) function get automatically assumed to be std::max(…) . It is easy to suppress the problem with define NOMINMAX when I load the pre build binaries . Someone deleted properly half a line of code there somewhere.

My problem now is I try to build myself the c++ backend with DNN and MPI so I run into this

E:\pytorch\third_party\gloo\gloo\mpi\context.cc(43): warning C4297: “gloo::mpi::MPIScope::~MPIScope”: The function throws an unexpected exception
E:\pytorch\third_party\gloo\gloo\mpi\context.cc(43): note: Destructor or deallocator has an (possibly implicit) non-throwing exception specification
E:\pytorch\third_party\gloo\gloo\mpi\context.cc(105): error C2672: “std::max”: No matching overloaded function found

So I’m not sure where I can add my NOMINMAX

Okay I read it gloo doesn’t work with windows USE_GLOO=0

but now I have this error

FAILED: bin/torch_cuda.dll lib/torch_cuda.lib C:\WINDOWS\system32\cmd.exe /C “cd . && “C:\Program Files\CMake\bin\cmake.exe” -E vs_link_dll --intdir=caffe2\CMakeFiles\torch_cuda.dir --rc=C:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\mt.exe --manifests – C:\PROGRA1\MICROS2\2022\COMMUN1\VC\Tools\MSVC\14391.335\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\torch_cuda.rsp /out:bin\torch_cuda.dll /implib:lib\torch_cuda.lib /pdb:bin\torch_cuda.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO && cd .” LINK: command “C:\PROGRA1\MICROS2\2022\COMMUN1\VC\Tools\MSVC\14391.335\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\torch_cuda.rsp /out:bin\torch_cuda.dll /implib:lib\torch_cuda.lib /pdb:bin\torch_cuda.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /MANIFEST:EMBED,ID=2” failed (exit code 1120) with the following output: Creating library “lib\torch_cuda.lib” and object “lib\torch_cuda.exp”. LINK : warning LNK4098: Default library “LIBCMT” conflicts with other libraries; use /NODEFAULTLIB:library.

then the linker failed on magma couldn’t resolve also it seems not to resolve the intel MKL correctly