mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: There are two corrections in this pull request. The first is specific to gcc-7.4.0. compiled with -std=c++14 gcc-7.4.0 has __cplusplus = 201402L This does not meet the check set in Deprecated.h, which asks for >201402L. The compiler goes down to the __GNUC__ check, which passes and sets C10_DEPRECATED_MESSAGE to a value that c++14 does not appear to support or even recognize, leading to a compile time error. My recommended solution, which worked for my case, was to change the = into a >= The second correction comes in response to this error: caffe2/operators/crash_op.cc: In member function ‘virtual bool caffe2::CrashOp::RunOnDevice()’: caffe2/operators/crash_op.cc:14:11: error: ‘SIGABRT’ was not declared in this scope I am merely committing to the repository the solution suggested here (which worked for me) https://discuss.pytorch.org/t/building-pytorch-from-source-in-conda-fails-in-pytorch-caffe2-operators-crash-op-cc/42859 Pull Request resolved: https://github.com/pytorch/pytorch/pull/19470 Differential Revision: D15019529 Pulled By: ailzhang fbshipit-source-id: 9ce9d713c860ee5fd4266e5c2a7f336a97d7a90d
27 lines
560 B
C++
27 lines
560 B
C++
#if defined(__linux__)
|
|
|
|
#include "caffe2/core/context.h"
|
|
#include "caffe2/core/operator.h"
|
|
#include <csignal>
|
|
|
|
namespace caffe2 {
|
|
|
|
class CrashOp final : public Operator<CPUContext> {
|
|
public:
|
|
CrashOp(const OperatorDef& operator_def, Workspace* ws)
|
|
: Operator<CPUContext>(operator_def, ws) {}
|
|
|
|
bool RunOnDevice() override {
|
|
raise(SIGABRT);
|
|
return true;
|
|
}
|
|
};
|
|
|
|
OPERATOR_SCHEMA(Crash).NumInputs(0).NumOutputs(0).SetDoc(
|
|
R"DOC(Crashes the program. Use for testing)DOC");
|
|
|
|
REGISTER_CPU_OPERATOR(Crash, CrashOp);
|
|
|
|
} // namespace caffe2
|
|
#endif
|