如何在Linux上使用我的项目构建Tensorflow c ++ API?

时间:2016-11-01 02:41:03

标签: c++ tensorflow

我一直在使用Tensorflow开发一个C ++项目。该项目可以正常构建,但它只使用CPU。

我在Tensorflow中执行配置文件(检查启用GPU),我尝试使用 - config = cuda 选项构建它,但是由于此错误而失败了。

(在tensorflow示例中使用GPU构建label_image)

--------- beginning of system
11-02 02:29:48.790 1014-2030/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.segall.logapp/.MainActivity} from uid 2000 from pid 29625 on display 0
11-02 02:29:48.790 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.START_ANY_ACTIVITY of 2000 is denied.
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set freq: 1950000
11-02 02:29:48.792 1014-1231/? I/libPerfService: 1: set: 4
11-02 02:29:48.793 1014-2030/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.WRITE_MEDIA_STORAGE of 10014 is denied.
11-02 02:29:48.798 1014-2036/? W/PackageManager: checkUidPermission(): android.permission.READ_EXTERNAL_STORAGE of 10014 is denied.
11-02 02:29:48.800 330-330/? I/BufferQueue: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [unnamed-330-1869](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: unnamed-330-1869
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setConsumerName: Starting com.example.segall.logapp
11-02 02:29:48.800 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:48.803 330-330/? I/BufferQueueConsumer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:48.803 330-330/? I/SurfaceFlinger: [Built-in Screen (type:0)] fps:1.709773,dur:4094.11,max:3980.13,min:16.10
11-02 02:29:48.807 330-443/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) connect(P): api=2 producer=(1014:system_server) producerControlledByApp=false
11-02 02:29:48.807 330-1043/? I/BufferQueueProducer: [Starting com.example.segall.logapp](this:0x7fae55d400,id:1869,api:2,p:1014,c:330) new GraphicBuffer needed
11-02 02:29:48.809 29645-29645/? I/art: Late-enabling -Xcheck:jni
11-02 02:29:48.809 1014-2036/? I/ActivityManager: Start proc 29645:com.example.segall.logapp/u0a14 for activity com.example.segall.logapp/.MainActivity
11-02 02:29:48.810 1014-1032/? W/PackageManager: checkUidPermission(): android.permission.INTERNET of 10014 is denied.
11-02 02:29:48.815 1014-1036/? I/WindowManager: Focus moving from Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} to null
11-02 02:29:48.815 1014-1036/? I/WindowManager: Losing focus: Window{da2cb0d u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
11-02 02:29:48.825 1014-1378/? I/libPerfService: perfSetFavorPid - pid:29645, 73cd
11-02 02:29:48.839 29645-29645/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:29:48.844 330-443/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.844 330-443/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) getReleasedBuffers: returning mask 0xffffffffffffffff
11-02 02:29:48.849 330-1043/? I/BufferQueueProducer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:330) disconnect(P): api 1
11-02 02:29:48.851 29645-29654/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:29:48.853 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.975 29645-29645/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.REAL_GET_TASKS of 10014 is denied.
11-02 02:29:48.977 1014-2030/? W/PackageManager: checkUidPermission(): android.permission.GET_TASKS of 10014 is denied.
11-02 02:29:48.998 330-330/? I/BufferQueueProducer: [FrameBufferSurface_0](this:0x7fb0759000,id:0,api:1,p:330,c:330) queueBuffer: fps=2.00 dur=5985.78 max=5805.78 min=14.24
11-02 02:29:49.063 330-330/? I/BufferQueueConsumer: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) disconnect(C)
11-02 02:29:49.064 330-330/? I/BufferQueue: [com.android.systemui/com.android.systemui.recents.RecentsActivity](this:0x7fae55e800,id:1867,api:1,p:-1,c:-1) ~BufferQueueCore
11-02 02:29:49.128 29645-29645/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-02 02:29:49.143 1014-2075/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS of 10014 is denied.
11-02 02:29:49.143 1014-14701/? W/PackageManager: checkUidPermission(): android.permission.INTERACT_ACROSS_USERS_FULL of 10014 is denied.
11-02 02:29:49.213 1014-4093/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1377/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.217 1014-1378/? I/PowerManagerService: setBrightness mButtonLight 0.
11-02 02:29:49.219 1014-30758/? I/PowerManagerService: setBrightness mButtonLight 0.


11-02 02:29:49.317 29645-29645/com.example.segall.logapp E/mylog: Log.e surprisingly this works


11-02 02:29:49.320 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.323 330-443/? I/SurfaceFlinger: EventThread Client Pid (29645) created
11-02 02:29:49.334 330-1043/? I/SurfaceFlinger: [SF client] NEW(0x7fae011a80) for (1014:system_server)
11-02 02:29:49.367 1014-1986/? W/PackageManager: checkUidPermission(): android.permission.STATUS_BAR of 10014 is denied.
11-02 02:29:49.368 330-330/? I/BufferQueue: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:-1) BufferQueue core=(330:/system/bin/surfaceflinger)
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) connect(C): consumer=(330:/system/bin/surfaceflinger) controlledByApp=false
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [unnamed-330-1870](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: unnamed-330-1870
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setConsumerName: com.example.segall.logapp/com.example.segall.logapp.MainActivity
11-02 02:29:49.368 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1 height=1
11-02 02:29:49.376 330-330/? I/BufferQueueConsumer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:0,p:-1,c:330) setDefaultBufferSize: width=1080 height=1920
11-02 02:29:49.379 1014-1036/? I/WindowManager: Focus moving from null to Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}
11-02 02:29:49.379 1014-1036/? I/WindowManager: Gaining focus: Window{4f3b63c u0 com.example.segall.logapp/com.example.segall.logapp.MainActivity}


11-02 02:29:49.380 29645-29672/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)


11-02 02:29:49.384 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:29:49.394 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:29:49.395 29645-29672/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:29:49.398 330-440/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) connect(P): api=1 producer=(29645:com.example.segall.logapp) producerControlledByApp=true
11-02 02:29:49.398 29645-29672/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:29:49.399 330-1044/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.406 330-443/? I/BufferQueueProducer: [StatusBar](this:0x7fb075a400,id:8,api:1,p:1335,c:330) queueBuffer: fps=0.15 dur=6482.88 max=6482.88 min=6482.88
11-02 02:29:49.460 1014-1036/? I/ActivityManager: [AppLaunch] Displayed Displayed com.example.segall.logapp/.MainActivity: +661ms
11-02 02:29:49.460 1014-1036/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{548a061 u0 com.example.segall.logapp/.MainActivity t1972} time:73473354
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set: 1
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set freq: 0
11-02 02:29:49.460 1014-1231/? I/libPerfService: 1: set vcore level: 0
11-02 02:29:49.515 330-1043/? I/BufferQueueProducer: [com.example.segall.logapp/com.example.segall.logapp.MainActivity](this:0x7fae55e800,id:1870,api:1,p:29645,c:330) new GraphicBuffer needed
11-02 02:29:49.531 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.532 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-1378/? E/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: com.example.segall.logapp
11-02 02:29:49.534 2491-2496/? I/PerfService: PerfServiceNative_getPackName
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? I/libPerfService: perfGetPackName com.example.segall.logapp
11-02 02:29:49.534 1014-14701/? E/PerfService: com.example.segall.logapp

我的项目树

$$ bazel build -c opt --config=cuda //engine:main

ERROR: /home/User/.cache/bazel/_bazel_User/aa58bdbbe2038eb91c944f024098159f/external/local_config_cuda/crosstool/BUILD:4:1: Traceback (most recent call last):
    File "/home/User/.cache/bazel/_bazel_User/aa58bdbbe2038eb91c944f024098159f/external/local_config_cuda/crosstool/BUILD", line 4
            error_gpu_disabled()
    File "/home/User/.cache/bazel/_bazel_User/aa58bdbbe2038eb91c944f024098159f/external/local_config_cuda/crosstool/error_gpu_disabled.bzl", line 3, in error_gpu_disabled
            fail("ERROR: Building with --config=c...")
ERROR: Building with --config=cuda but TensorFlow is not configured to build  with GPU support. Please re-run ./configure and enter 'Y' at the prompt to build with GPU support.
ERROR: no such target '@local_config_cuda//crosstool:toolchain': target 'toolchain' not declared in package 'crosstool' defined by /home/wklee/.cache/bazel/_bazel_User/aa58bdbbe2038eb91c944f024098159f/external/local_config_cuda/crosstool/BUILD.

WORKSPACE ::

|-- WORKSPACE
|-- configure
|-- engine
|   |-- BUILD
|   `-- main.cc
|-- models
|-- tensorflow
|-- tools
|   `-- bazel.rc

我对bazel并不熟悉,也不太了解工具中的 bazel.rc 文件。它只是从tensorflow目录

复制

0 个答案:

没有答案