Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

add system/anaconda dirs to build_env.py, filter non-existent dirs #5

Merged
merged 3 commits into from
Jul 27, 2015

Conversation

jeffdonahue
Copy link
Contributor

This adds /usr/{include,lib} and $HOME/anaconda/{include,lib} to the include/lib dir variables of build_env.py. The last commit also filters out non-existent dirs. (I'm sure there's a better/more general way to get the anaconda include/lib dirs, and there could be a good reason why any of these things weren't done to begin with -- happy to remove any subset of the commits from this PR.)

I think the default install location for gflags (or some other dependency) on Ubuntu was the /usr/{include,lib} dirs, and the Anaconda version of OpenCV is more up to date than Ubuntu's (which I could never install caffe or caffe2 with).

@@ -143,18 +143,24 @@ class Env(object):
# General include folders.
INCLUDES = NVCC_INCLUDES + MPI_INCLUDES + [
GENDIR,
os.path.join(os.environ['HOME'], 'anaconda/include'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, interesting, could you check if the python include command (the _GetPythonIncludes function in the same file) correctly captures the anaconda include?

I figured that different people install python at different places (system python. /usr/local python, anaconda python at various locations...), so it may be safer to specify what python and python-config people use, and infer the include paths (and lib paths). What do you think?

@jeffdonahue
Copy link
Contributor Author

Thanks -- you're right, GetPythonIncludes gives the include dir, so I removed that. I still needed the addition to LIBDIRS to build (OpenCV), so I added a GetPythonLibraries function which (like GetPythonIncludes) uses python-config. For some reason python-config doesn't appear to have a way of showing library dirs, so I just did python-config --prefix and appended the lib subdir.

@Yangqing
Copy link
Contributor

Awesome! I realized that I did not have a GetPythonLibraries function when I was writing the reply :)

Yangqing added a commit that referenced this pull request Jul 27, 2015
add system/anaconda dirs to build_env.py, filter non-existent dirs
@Yangqing Yangqing merged commit f2f303f into facebookarchive:master Jul 27, 2015
@jeffdonahue jeffdonahue deleted the add-to-build-env-dirs branch July 28, 2015 00:47
slayton58 added a commit to slayton58/caffe2 that referenced this pull request Dec 15, 2016
bwasti added a commit that referenced this pull request Dec 28, 2016
merge caffe2:master into bwasti:master
lukeyeager pushed a commit to lukeyeager/caffe2 that referenced this pull request Apr 21, 2017
…ming-metrics

[seq2seq] Print timing metrics
facebook-github-bot pushed a commit that referenced this pull request Sep 14, 2017
Summary:
UBSan report:

```
UndefinedBehaviorSanitizer: dynamic-type-mismatch caffe2/caffe2/core/tensor.h:786:22 in
caffe2/caffe2/core/tensor.h:787:19: runtime error: member call on address 0x60c01f610440 which does not point to an object of type 'caffe2::Tensor<caffe2::Tensor<caffe2::CPUContext> >'
*** Aborted at 1505298367 (Unix time, try 'date -d 1505298367') ***
*** Signal 6 (SIGABRT) (0xf2) received by PID 242 (pthread TID 0x7fb376f06700) (linux TID 33215) (maybe from PID 242, UID 0), stack trace: ***
0x60c01f610440: note: object is of type 'N6caffe26TensorINS_10CPUContextEEE'
 07 5e 81 60  c8 47 13 35 00 00 00 00  90 f3 73 80 20 60 00 00  98 f3 73 80 20 60 00 00  a0 f3 73 80
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'N6caffe26TensorINS_10CPUContextEEE'
    #0 0x1f0d1c22 in std::vector<long, std::allocator<long> > caffe2::GetTensorInfo<caffe2::Tensor<caffe2::CPUContext> >(void const*, bool*, unsigned long*, caffe2::DeviceOption*) caffe2/caffe2/core/tensor.h:787:19
    #1 0x9a5e0a1 in caffe2::FacebookOperatorObserver::log() caffe2/caffe2/fb/init/net_observer.cpp:300:15
    #2 0x9a5b49d in caffe2::FacebookOperatorObserver::Stop() caffe2/caffe2/fb/init/net_observer.cpp:229:11
    #3 0x447d046 in caffe2::Operator<caffe2::CPUContext>::Run(int) caffe2/caffe2/core/operator.h:308:20
    #4 0x1ecedb2f in caffe2::SimpleNet::Run() caffe2/caffe2/core/net_simple.cc:51:14
    #5 0x1f1ba169 in caffe2::Workspace::RunNet(std::basic_fbstring<char, std::char_traits<char>, std::allocator<char>, std::fbstring_core<char> > const&) caffe2/caffe2/core/workspace.cc:211:26
...
```

The bug is that `GetTensorType` and `GetTensorType` take context as template argument, not tensor itself.

Reviewed By: bddppq

Differential Revision: D5826781

fbshipit-source-id: 9cfd2ca1aaef6f8ee8a556ce7b553c0a4f43a100
facebook-github-bot pushed a commit that referenced this pull request Sep 25, 2017
Summary:
Exposed by UBSAN:
```lang=bash
caffe2/caffe2/core/qtensor.h:61:40: runtime error: load of value 190, which is not a valid value for type 'bool'
    #0 0x7fb4fc09c289 in caffe2::QTensor<caffe2::CPUContext>::Resize(std::vector<int, std::allocator<int> >) caffe2/caffe2/core/qtensor.h:61
    #1 0x7fb4fc090403 in caffe2::QuantizedFullyConnectedOp<float, caffe2::CPUContext, caffe2::DefaultEngine>::RunOnDevice() caffe2/caffe2/fb/operators/quantized_fully_connected_op.h:93
    #2 0x7fb4fc08d5ee in caffe2::Operator<caffe2::CPUContext>::Run(int) caffe2/caffe2/core/operator.h:306
    #3 0x426d8a in caffe2::QFCTest(float, float, float, int, int, int, int) caffe2/caffe2/fb/operators/quantized_fully_connected_op_test.cc:78
    #4 0x4295f6 in caffe2::QuantizedFullyConnectedTest_Test_Test::TestBody() caffe2/caffe2/fb/operators/quantized_fully_connected_op_test.cc:110
    #5 0x7fb4eee3b6a1 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:2458
    #6 0x7fb4eee2cbe1 in testing::Test::Run() /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:2475
    #7 0x7fb4eee2cd27 in testing::TestInfo::Run() /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:2656
    #8 0x7fb4eee2ce34 in testing::TestCase::Run() /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:2774
    #9 0x7fb4eee2eb8b in testing::internal::UnitTestImpl::RunAllTests() /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:4649
    #10 0x7fb4eee2ef3c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:2458
    #11 0x7fb4eee2ef3c in testing::UnitTest::Run() /home/engshare/third-party2/googletest/master/src/googletest/googletest/src/gtest.cc:4257
    #12 0x7fb4fbee2ed0 in RUN_ALL_TESTS() third-party-buck/gcc-5-glibc-2.23/build/googletest/include/gtest/gtest.h:2233
    #13 0x7fb4fbee2d60 in main common/gtest/LightMain.cpp:12
    #14 0x7fb4e0ef7857 in __libc_start_main /home/engshare/third-party2/glibc/2.23/src/glibc-2.23/csu/../csu/libc-start.c:289
    #15 0x424e08 in _start /home/engshare/third-party2/glibc/2.23/src/glibc-2.23/csu/../sysdeps/x86_64/start.S:118
UndefinedBehaviorSanitizer: invalid-bool-load caffe2/caffe2/core/qtensor.h:61:40
```

Reviewed By: yfeldblum

Differential Revision: D5898877

fbshipit-source-id: e32b1732a1946fdafaec67b3fbc072dc93bcd917
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants