amd / OpenCL-caffe

This is a Experimental version of OpenCL by AMD Research, we now recommend you to use The official BVLC Caffe OpenCL branch is over at Caffe branch now at https://github.com/BVLC/caffe/tree/opencl
Other
516 stars 152 forks source link

OSX 10.10.5 MacPro 2013 AMD Radeon - FirePro d300 x2 #19

Open omarev-git opened 8 years ago

omarev-git commented 8 years ago

Hello I want to run Caffe on OSX to use their GPUs. I could build the binaries but these fail when I try to run it. I change the the references to AMDAPPSDK for OpenCL.Framework that come with Yosemite. Exactly when I run caffe I got: ❯ ./caffe device_query Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011633.31490!Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011633.31490!Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011633.31490!Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011633.31490!F1218 01:16:33.235122 1889116928 caffe.cpp:75] Check failed: FLAGS_gpu > -1 (-1 vs. -1) Need a device ID to query. * Check failure stack trace: * @ 0x109cc920a google::LogMessage::Fail() @ 0x109cc88eb google::LogMessage::SendToLog() @ 0x109cc8e59 google::LogMessage::Flush() @ 0x109ccc1af google::LogMessageFatal::~LogMessageFatal() @ 0x109cc94f7 google::LogMessageFatal::~LogMessageFatal() @ 0x1094d180e device_query() @ 0x1094d6aab main @ 0x7fff827175c9 start [1] 31490 abort ./caffe device_query

also I run: ❯ ./caffe device_query 0 ⏎ caffe: command line brew usage: caffe

commands: train train or finetune a model test score a model device_query show GPU diagnostic information time benchmark model execution time

Flags from tools/caffe.cpp: -gpu (Run in GPU mode on given device ID.) type: int32 default: -1 -iterations (The number of iterations to run.) type: int32 default: 50 -model (The model definition protocol buffer text file..) type: string default: "" -snapshot (Optional; the snapshot solver state to resume training.) type: string default: "" -solver (The solver definition protocol buffer text file.) type: string default: "" -weights (Optional; the pretrained weights to initialize finetuning. Cannot be set simultaneously with snapshot.) type: string default: "" Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011644.31508!%

And when I try to run ❯ make runtest .build_debug/tools/caffe caffe: command line brew usage: caffe

commands: train train or finetune a model test score a model device_query show GPU diagnostic information time benchmark model execution time

Flags from tools/caffe.cpp: -gpu (Run in GPU mode on given device ID.) type: int32 default: -1 -iterations (The number of iterations to run.) type: int32 default: 50 -model (The model definition protocol buffer text file..) type: string default: "" -snapshot (Optional; the snapshot solver state to resume training.) type: string default: "" -solver (The solver definition protocol buffer text file.) type: string default: "" -weights (Optional; the pretrained weights to initialize finetuning. Cannot be set simultaneously with snapshot.) type: string default: "" Could not create logging file: No such file or directory COULD NOT CREATE A LOGGINGFILE 20151218-011901.31805!.build_debug/test/test_all.testbin 0 --gtest_shuffle Err: Failed to build program � ��Setting to use device 0 Current device id: 0 Err: Failed to build program � ��Note: Randomizing tests' orders with a seed of 93179 . [==========] Running 1339 tests from 207 test cases. [----------] Global test environment set-up. [----------] 7 tests from SGDSolverTest/3, where TypeParam = N5caffe9GPUDeviceIdEE [ RUN ] SGDSolverTest/3.TestLeastSquaresUpdateLROneTenth Err: Failed to build program `G�T�* Aborted at 1450415941 (unix time) try "date -d @1450415941" if you are using GNU date * PC: @ 0x7fff8ca34b7f __dynamic_cast * SIGSEGV (@0x0) received by PID 31806 (TID 0x7fff7099a300) stack trace: * @ 0x7fff8fc76f1a _sigtramp @ 0x7fff54a9eff0 (unknown) @ 0x7fff8b266d5a clLogMessagesToStderrAPPLE @ 0x7fff8b275b0f clCreateKernel @ 0x111432d3f caffe::SyncedMemory::ocl_setup() @ 0x11127d313 caffe::SyncedMemory::SyncedMemory() @ 0x11125fe8d caffe::SyncedMemory::SyncedMemory() @ 0x111266773 caffe::Blob<>::Reshape() @ 0x111265fa3 caffe::Blob<>::Reshape() @ 0x11130229f caffe::DummyDataLayer<>::LayerSetUp() @ 0x111350131 caffe::Layer<>::SetUp() @ 0x1113e70f1 caffe::Net<>::Init() @ 0x1113e56ec caffe::Net<>::Net() @ 0x1113eb1ad caffe::Net<>::Net() @ 0x11141c22a caffe::Solver<>::InitTrainNet() @ 0x11141b483 caffe::Solver<>::Init() @ 0x11141b14e caffe::Solver<>::Solver() @ 0x10b2df4cc caffe::SGDSolver<>::SGDSolver() @ 0x10b30b19d caffe::SGDSolver<>::SGDSolver() @ 0x10b30b065 caffe::SGDSolverTest<>::InitSolver() @ 0x10b2df13b caffe::GradientBasedSolverTest<>::InitSolverFromProtoString() @ 0x10b2e1ffa caffe::GradientBasedSolverTest<>::RunLeastSquaresSolver() @ 0x10b2eb090 caffe::GradientBasedSolverTest<>::TestLeastSquaresUpdate() @ 0x10b3117e1 caffe::SGDSolverTest_TestLeastSquaresUpdateLROneTenth_Test<>::TestBody() @ 0x10b6ba173 testing::internal::HandleSehExceptionsInMethodIfSupported<>() @ 0x10b6a6007 testing::internal::HandleExceptionsInMethodIfSupported<>() @ 0x10b68bc85 testing::Test::Run() @ 0x10b68cdab testing::TestInfo::Run() @ 0x10b68db77 testing::TestCase::Run() @ 0x10b694f69 testing::internal::UnitTestImpl::RunAllTests() @ 0x10b6b6a33 testing::internal::HandleSehExceptionsInMethodIfSupported<>() @ 0x10b6a8137 testing::internal::HandleExceptionsInMethodIfSupported<>() make: *\ [runtest] Segmentation fault: 11

I apreciate very much if someone can giveme some tip to make Caffe can use my AMD cards, thanks in advance. P.D. The config and makefile that I modified are attached. Archive.zip

zupamario commented 8 years ago

I managed to get around the crash and investigate the build log to understand why the program fails building.

Unfortunately we can not use OpenCL-caffe on Macos at the moment. All kernels use an AMD extension which allows the use of templates in OpenCL kernel definitions. This is not supported on OSX. More details on the extension can be found here

naibaf7 commented 8 years ago

@zupamario Have you tried my branch instead? https://github.com/naibaf7/caffe Some users got it to work on OS X.

The point is, I'm using macro-template substitution instead of OpenCL templates. This means the minimal requirement to run my branch is pure OpenCL 1.1, which should run just about on anything.

hughperkins commented 8 years ago

@naibaf7 Seems like this issue might have a similar challenge: https://github.com/amd/OpenCL-caffe/issues/17#issuecomment-168993460

naibaf7 commented 8 years ago

@hughperkins We already got Caffe OpenCL working on android, over here: https://github.com/sh1r0/caffe-android-lib/tree/opencl_dev Discussion: https://github.com/sh1r0/caffe-android-lib/issues/23

unfortunately, it is slow.