Im having same problem, how we can solve the real problem of gloo library development files?
I guess something related to https://code.ihub.org.cn/projects/123/repositories/159/file_edit_page?file_name=FindGloo.cmake&path=cmake%2FModules%2FFindGloo.cmake&rev=master 3 (which I downloaded and can compile on my own)
Also I guess this is the library? GitHub - facebookincubator/gloo: Collective communications library with various primitives for multi-machine training. 2
But the point it is that is inside the third party libs
[ 22%] Building NVCC (Device) object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/gloo_cuda_generated_cuda.cu.o
    In file included from /home/tyoc213/Documents/github/pytorch/third_party/gloo/gloo/cuda_private.cu:9:
    In file included from /home/tyoc213/Documents/github/pytorch/torch/include/gloo/cuda_private.h:20:
    /home/tyoc213/Documents/github/pytorch/torch/include/gloo/cuda.h:24:2: error: "Expected GLOO_USE_CUDA to be defined"
    #error "Expected GLOO_USE_CUDA to be defined"
     ^
    In file included from /home/tyoc213/Documents/github/pytorch/third_party/gloo/gloo/cuda.cu:9:
    /home/tyoc213/Documents/github/pytorch/torch/include/gloo/cuda.h:24:2: error: "Expected GLOO_USE_CUDA to be defined"
    #error "Expected GLOO_USE_CUDA to be defined"
     ^
    1 error generated.
    CMake Error at gloo_cuda_generated_cuda_private.cu.o.Release.cmake:217 (message):
      Error generating
      /home/tyoc213/Documents/github/pytorch/build/third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir//./gloo_cuda_generated_cuda_private.cu.o


    make[2]: *** [third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/build.make:91: third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/gloo_cuda_generated_cuda_private.cu.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    Scanning dependencies of target dnnl
    1 error generated.
    CMake Error at gloo_cuda_generated_cuda.cu.o.Release.cmake:217 (message):
      Error generating
      /home/tyoc213/Documents/github/pytorch/build/third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir//./gloo_cuda_generated_cuda.cu.o


    make[2]: *** [third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/build.make:84: third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/gloo_cuda_generated_cuda.cu.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:3734: third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....