tensorflow-gpu运行测试代码,卡在 I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu

新建一个环境解释器后,想要运行测试代码如下,会发现不管是cmd运行还是pycharm运行,都会卡在“Device mapping”的上一句 I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0然后就不动了如下图,我试着重新运行了两次就好了,貌似第一次运行GPU的时候就会卡在这里会很慢,运行卡在那句后就耐心等待即可
 


import tensorflow as tf

a=tf.constant([1,2,3],shape=[3],name="a")

b=tf.constant([1,2,3],shape=[3],name="b")

 

c=a+b

sess=tf.Session(config=tf.ConfigProto(log_device_placement=True))

print(sess.run(c))

sess.close()

 

'''

显示如下,即成功

2019-05-28 09:37:49.590066: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

2019-05-28 09:37:50.501663: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: 

name: GeForce GTX 960M major: 5 minor: 0 memoryClockRate(GHz): 1.176

pciBusID: 0000:02:00.0

totalMemory: 4.00GiB freeMemory: 3.34GiB

2019-05-28 09:37:50.502165: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0

Device mapping:

/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 960M, pci bus id: 0000:02:00.0, compute capability: 5.0

add: (Add): /job:localhost/replica:0/task:0/device:GPU:0

a: (Const): /job:localhost/replica:0/task:0/device:GPU:0

b: (Const): /job:localhost/replica:0/task:0/device:GPU:0

2019-05-28 09:37:51.816402: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:

2019-05-28 09:37:51.816683: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 

2019-05-28 09:37:51.816848: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N 

2019-05-28 09:37:51.817173: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3050 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960M, pci bus id: 0000:02:00.0, compute capability: 5.0)

2019-05-28 09:37:51.819865: I tensorflow/core/common_runtime/direct_session.cc:317] Device mapping:

/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 960M, pci bus id: 0000:02:00.0, compute capability: 5.0

 

2019-05-28 09:37:51.822325: I tensorflow/core/common_runtime/placer.cc:1059] add: (Add)/job:localhost/replica:0/task:0/device:GPU:0

2019-05-28 09:37:51.822733: I tensorflow/core/common_runtime/placer.cc:1059] a: (Const)/job:localhost/replica:0/task:0/device:GPU:0

2019-05-28 09:37:51.823151: I tensorflow/core/common_runtime/placer.cc:1059] b: (Const)/job:localhost/replica:0/task:0/device:GPU:0

[2 4 6]

'''

 

  • 19
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 66
    评论
make for plat=atlas310 cross=aarch64-ascend310-linux-gnu- LDFLAGS=-Wl,--gc-sections -static -L/home/257916/server/test/v1.1/Trunk/build/../src/thirdpart/libs/atlas310 -L/home/257916/server/test/v1.1/Trunk/build/../lib/atlas310 -ldw -lbs -lpthread -lm EXTRA_CFLAGS=-DSVN_VERSION="\"64670"\" -I /net -DOSA_MODULE_NAME=Spectrum-Convert@64670 -DBUILD_DATE="\"Mon, 24 Jul 2023 19:48:54 +0800"\" CFLAGS=-D_GNU_SOURCE -I/home/257916/server/test/v1.1/Trunk/build/../include -I/home/257916/server/test/v1.1/Trunk/build/../src/base/include -I/home/257916/server/test/v1.1/Trunk/build/../src/base/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/decode/include -I/home/257916/server/test/v1.1/Trunk/build/../src/decode/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/fourier/include -I/home/257916/server/test/v1.1/Trunk/build/../src/fourier/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/include -I/home/257916/server/test/v1.1/Trunk/build/../src/service/include -I/home/257916/server/test/v1.1/Trunk/build/../src/service/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/draw/include -I/home/257916/server/test/v1.1/Trunk/build/../src/draw/test/include -I/home/257916/server/test/v1.1/Trunk/build/../tools/include -fPIC -ffunction-sections -fdata-sections -g -Wall -O1 -c -o ############################################################ mkdir -p /home/257916/server/test/v1.1/Trunk/build/../bin/atlas310 aarch64-ascend310-linux-gnu-g++ -o draw test/src/draw_pic_test.o -Wl,--gc-sections -static -L/home/257916/server/test/v1.1/Trunk/build/../src/thirdpart/libs/atlas310 -L/home/257916/server/test/v1.1/Trunk/build/../lib/atlas310 -ldw -lbs -lpthread -lm /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status make[1]: *** [draw] Error 1 make[1]: Leaving directory `/home/257916/server/test/v1.1/Trunk/src/draw' make: *** [draw] Error 2
07-25
根你提供的信息,编译过程中出现了一个错误。错误信息显示 ld (链接器) 试图处理一个格式错误的文件。 具体来说,ld 报告了以下错误: ``` /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status ``` 这个错误通常发生在尝试链接不兼容的目标文件时。可能有以下几个原因导致这个错误: 1. 目标文件 `test/src/draw_pic_test.o` 的格式不正确,不符合链接器的预期。你可能需要检查这个目标文件是否由正确的编译器生成,并且是否与你的交叉编译目标匹配。 2. 链接器正在尝试将不同架构的目标文件链接在一起。请确保你的交叉编译环境配置正确,并且编译器和链接器的目标架构与你的目标平台一致。 3. 缺少必要的库文件。请确保你的链接命令中指定的库文件存在,并且位于正确的位置。 针对这个错误,你可以尝试以下几个步骤来解决问题: 1. 检查目标文件的生成方式和来源。确保使用正确的编译器和编译选项生成目标文件,并确认目标文件的格式正确。 2. 检查你的交叉编译环境配置,确保交叉编译器和链接器的目标架构与你的目标平台一致。 3. 检查链接命令中指定的库文件路径是否正确,并确保库文件存在。 如果问题仍然存在,可能需要更多的上下文信息来进行进一步的诊断和解决。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 66
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值