Issue 1:
Issue description

When I compile external C++ app with CMake using Caffe2 dependency, ATen header is missing.

fatal error: ATen/core/Macros.h: No such file or directory

Seems like ATen headers are not properly copied to /usr/local/include while other headers are well installed.

Reproduced with Caffe2 with Ubuntu 16.04/CUDA 8/CuDNN 7 Dockerfile here.

I was able to resolve the issue by adding the following line to the Dockerfile.

RUN cp -RL /usr/pytorch/aten/src/ATen /usr/local/include/

Code example

I used /usr/local/include as my Caffe2 include directory in my FindCaffe2.cmake as below.

find_path(Caffe2_INCLUDE_DIR NAMES caffe2 onnx google eigen3 ATen HINTS /usr/local/include)

I include four header files in my app, and it makes compile error.

#include <caffe2/core/init.h>

#include <caffe2/core/net.h>

#include <caffe2/core/context_gpu.h>

#include <caffe2/utils/proto_utils.h>

System Info

Ubuntu 16.04 / CUDA 8.0 / CuDNN 7.1 on Docker.

PyTorch or Caffe2: Caffe2

How you installed PyTorch (conda, pip, source): source

Build command you used (if compiling from source): built Dockerfile.

OS: Ubuntu 16.04

PyTorch version: master

Python version: 2

CUDA/cuDNN version: 8.0/7.1

GPU models and configuration: GTX 1080 Ti

GCC version (if compiling from source): 5.4

CMake version: 3.5.1

Versions of any other relevant libraries:

Issue 2:
Issue Description

I git clone pytorch to $PYTORCH_HOME, and installed it using cmake to directory $PYTORCH_HOME/build/install. The ATen core headers were installed to $PYTORCH_HOME/build/install/include/ATen/core/core/*.h instead of $PYTORCH_HOME/build/install/include/ATen/core/*.h (I think this is abnormal, because compiling custom operators requires <ATen/core/*.h>. See below.).

The result of tree $PYTORCH_HOME/build/install/include/ATen:

ATen
`-- core
`-- core
|-- AlignOf.h
|-- ArrayRef.h
|-- ATenCoreTest.h
|-- Backtrace.h
|-- C++17.h
|-- CoreAPI.h
|-- DeviceType.h
|-- Error.h
|-- Half.h
|-- Half-inl.h
|-- IdWrapper.h
|-- intrusive_ptr.h
|-- optional.h
|-- SmallVector.h
`-- UniqueVoidPtr.h

In the DensePose project which uses Caffe2, when I built custom operators:

# In DensePose project
mkdir build && cd build
cmake .. -DCaffe2_DIR=$PYTORCH_HOME/build/install/share/cmake/Caffe2
make

The make command threw error of not finding <ATen/core/Error.h> for caffe2/core/logging.h:

Scanning dependencies of target caffe2_detectron_custom_ops
[ 12%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/pool_points_interp.cc.o
In file included from /home/users/houjing.huang/Software/pytorch/build/install/include/caffe2/core/allocator.h:6:0,
from /home/users/houjing.huang/Software/pytorch/build/install/include/caffe2/core/context.h:9,
from /home/users/houjing.huang/Project/DensePose/detectron/ops/pool_points_interp.h:13,
from /home/users/houjing.huang/Project/DensePose/detectron/ops/pool_points_interp.cc:10:
/home/users/houjing.huang/Software/pytorch/build/install/include/caffe2/core/logging.h:10:29: fatal error: ATen/core/Error.h: No such file or directory
#include <ATen/core/Error.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/pool_points_interp.cc.o] Error 1
make[1]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/all] Error 2
make: *** [all] Error 2

I found these lines in file $PYTORCH_HOME/build/install_manifest.txt:

/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/ATenCoreTest.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/AlignOf.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/ArrayRef.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/Backtrace.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/C++17.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/CoreAPI.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/DeviceType.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/Error.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/Half-inl.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/Half.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/IdWrapper.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/SmallVector.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/UniqueVoidPtr.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/intrusive_ptr.h
/mnt/data-1/data/houjing.huang/Software/pytorch/build/install/include/ATen/core/core/optional.h

System Info

PyTorch or Caffe2: Caffe2

How you installed PyTorch (conda, pip, source): source, referring to caffe2.ai

Build command to install Pytorch/Caffe2 (if compiling from source):

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
mkdir build && cd build
cmake \
-DCUDA_TOOLKIT_ROOT_DIR=$HOME/Software/cuda-8.0 \
-DCMAKE_INSTALL_PREFIX=${PWD}/install ..
make -j12 install

OS: CentOS Linux release 7.4.1708

PyTorch version: master branch, commit f57e4ce

Python version: 2.7

CUDA/cuDNN version: CUDA 8.0, cuDNN 7

GPU models and configuration:

GCC version (if compiling from source): 4.8.5

CMake version: 3.12.0

Versions of any other relevant libraries: DensePose master branch, commit e118a4

Log Files When Installing Pytorch/Caffe2

The log of pytorch cmake ..: log

The log of pytorch make -j12 install: log

install_manifest.txt

Is It A BUG?

I manually copied $PYTORCH_HOME/build/install/include/ATen/core/core/*.h to $PYTORCH_HOME/build/install/include/ATen/core/*.h and then it's ok to build custom operators and run the tests.

It seems a bug of Pytorch/Caffe2 make install?