Giter Club home page Giter Club logo

ics's Introduction

ICS

智能计算系统课程(陈云霁)课后作业记录。

这学期学习了这门课程,首先整体翻看了一下整本教材,感觉内容很多,但是如果不去实际操作的话,很可能就没有很好的效果,所以尝试着去完成教材课后的作业,分章节进行(从第二章开始,第一章的内容主要是一个概述),希望能一直坚持下去。 ---2020.4.9

ics's People

Contributors

leliyliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ics's Issues

用您的代码做了一下实验1,tensorflow编译不成功,请问是什么原因呢?

ERROR: /home/xxx/AICSE-demo-student/env/tensorflow-v1.10/tensorflow/stream_executor/mlu/BUILD:45:1: C++ compilation of rule '//tensorflow/stream_executor/mlu:mlu_api_lib_ops' failed (Exit 1): gcc failed: error executing command
(cd /root/.cache/bazel/bazel_root/a4ff5ff566d3dd2451bcf2ead3c6e9f4/execroot/org_tensorflow &&
exec env -
LD_LIBRARY_PATH=/home/xxx/AICSE-demo-student/env/neuware/lib64:/usr/local/neuware/lib64:/home/xxx/AICSE-demo-student/env/tensorflow-v1.10/third_party/mlu/lib
PATH=/opt/AICSE-demo-student/env/tensorflow-v1.10/virtualenv_mlu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/xxx/AICSE-demo-student/env/neuware/bin:/usr/local/neuware/bin
PWD=/proc/self/cwd
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/tensorflow/stream_executor/mlu/objs/mlu_api_lib_ops/mlu_lib_ops.pic.d '-frandom-seed=bazel-out/host/bin/tensorflow/stream_executor/mlu/objs/mlu_api_lib_ops/mlu_lib_ops.pic.o' -fPIC -D__CLANG_SUPPORT_DYN_ANNOTATION -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' '-DEIGEN_HAS_TYPE_TRAITS=0' -DTF_USE_SNAPPY -iquote . -iquote bazel-out/host/genfiles -iquote bazel-out/host/bin -iquote external/com_google_absl -iquote bazel-out/host/genfiles/external/com_google_absl -iquote bazel-out/host/bin/external/com_google_absl -iquote external/nsync -iquote bazel-out/host/genfiles/external/nsync -iquote bazel-out/host/bin/external/nsync -iquote external/eigen_archive -iquote bazel-out/host/genfiles/external/eigen_archive -iquote bazel-out/host/bin/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/host/genfiles/external/local_config_sycl -iquote bazel-out/host/bin/external/local_config_sycl -iquote external/gif_archive -iquote bazel-out/host/genfiles/external/gif_archive -iquote bazel-out/host/bin/external/gif_archive -iquote external/jpeg -iquote bazel-out/host/genfiles/external/jpeg -iquote bazel-out/host/bin/external/jpeg -iquote external/protobuf_archive -iquote bazel-out/host/genfiles/external/protobuf_archive -iquote bazel-out/host/bin/external/protobuf_archive -iquote external/zlib_archive -iquote bazel-out/host/genfiles/external/zlib_archive -iquote bazel-out/host/bin/external/zlib_archive -iquote external/com_googlesource_code_re2 -iquote bazel-out/host/genfiles/external/com_googlesource_code_re2 -iquote bazel-out/host/bin/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/host/genfiles/external/farmhash_archive -iquote bazel-out/host/bin/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/host/genfiles/external/fft2d -iquote bazel-out/host/bin/external/fft2d -iquote external/highwayhash -iquote bazel-out/host/genfiles/external/highwayhash -iquote bazel-out/host/bin/external/highwayhash -iquote external/double_conversion -iquote bazel-out/host/genfiles/external/double_conversion -iquote bazel-out/host/bin/external/double_conversion -iquote external/snappy -iquote bazel-out/host/genfiles/external/snappy -iquote bazel-out/host/bin/external/snappy -iquote external/hwloc -iquote bazel-out/host/genfiles/external/hwloc -iquote bazel-out/host/bin/external/hwloc -isystem third_party/mlu/include -isystem bazel-out/host/genfiles/third_party/mlu/include -isystem bazel-out/host/bin/third_party/mlu/include -isystem external/nsync/public -isystem bazel-out/host/genfiles/external/nsync/public -isystem bazel-out/host/bin/external/nsync/public -isystem external/eigen_archive -isystem bazel-out/host/genfiles/external/eigen_archive -isystem bazel-out/host/bin/external/eigen_archive -isystem external/gif_archive/lib -isystem bazel-out/host/genfiles/external/gif_archive/lib -isystem bazel-out/host/bin/external/gif_archive/lib -isystem external/protobuf_archive/src -isystem bazel-out/host/genfiles/external/protobuf_archive/src -isystem bazel-out/host/bin/external/protobuf_archive/src -isystem external/zlib_archive -isystem bazel-out/host/genfiles/external/zlib_archive -isystem bazel-out/host/bin/external/zlib_archive -isystem external/farmhash_archive/src -isystem bazel-out/host/genfiles/external/farmhash_archive/src -isystem bazel-out/host/bin/external/farmhash_archive/src -isystem external/double_conversion -isystem bazel-out/host/genfiles/external/double_conversion -isystem bazel-out/host/bin/external/double_conversion -isystem external/hwloc/hwloc -isystem bazel-out/host/genfiles/external/hwloc/hwloc -isystem bazel-out/host/bin/external/hwloc/hwloc -isystem external/hwloc/include -isystem bazel-out/host/genfiles/external/hwloc/include -isystem bazel-out/host/bin/external/hwloc/include -g0 -g0 -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare -fno-exceptions '-ftemplate-depth=900' '-DCAMBRICON_MLU=1' -msse3 -DTENSORFLOW_MONOLITHIC_BUILD -pthread -Werror '-Wno-error=unused-function' '-Wno-error=return-type' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE
_="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc -o bazel-out/host/bin/tensorflow/stream_executor/mlu/_objs/mlu_api_lib_ops/mlu_lib_ops.pic.o)
Execution platform: @bazel_tools//platforms:host_platform
In file included from tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:17:0:
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc: In function 'tensorflow::Status stream_executor::mlu::lib::CreatePowerDifferenceOp(MLUBaseOp**, MLUTensor*, MLUTensor*, int, MLUTensor*, int)':
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1924:96: error: cannot convert 'MLUTensor** {aka cnmlTensor**}' to 'cnmlPluginPowerDifferenceOpParam_t {aka cnmlPluginPowerDifferenceOpParam*}' for argument '2' to 'cnmlStatus_t cnmlCreatePluginPowerDifferenceOp(cnmlBaseOp**, cnmlPluginPowerDifferenceOpParam_t, cnmlTensor**, int, cnmlTensor**, int)'
CNML_RETURN_STATUS(cnmlCreatePluginPowerDifferenceOp(op, inputs_ptr, input3, outputs_ptr, len));
^
./tensorflow/stream_executor/mlu/mlu_api/lib_ops/util.h:135:29: note: in definition of macro 'TF_CNML_CHECK'
MLUStatus mlu_status = (VA_ARGS);
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1924:3: note: in expansion of macro 'CNML_RETURN_STATUS'
CNML_RETURN_STATUS(cnmlCreatePluginPowerDifferenceOp(op, inputs_ptr, input3, outputs_ptr, len));
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc: In function 'tensorflow::Status stream_executor::mlu::lib::ComputePowerDifferenceOp(MLUBaseOp*, MLUCnrtQueue*, void*, void*, void*)':
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1933:76: error: invalid conversion from 'void**' to 'cnmlTensor**' [-fpermissive]
op, inputs_ptr, outputs_ptr, queue));
^
./tensorflow/stream_executor/mlu/mlu_api/lib_ops/util.h:135:29: note: in definition of macro 'TF_CNML_CHECK'
MLUStatus mlu_status = (VA_ARGS);
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1932:3: note: in expansion of macro 'CNML_RETURN_STATUS'
CNML_RETURN_STATUS(cnmlComputePluginPowerDifferenceOpForward(
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1933:76: error: invalid conversion from 'MLUCnrtQueue* {aka cnrtQueue*}' to 'int' [-fpermissive]
op, inputs_ptr, outputs_ptr, queue));
^
./tensorflow/stream_executor/mlu/mlu_api/lib_ops/util.h:135:29: note: in definition of macro 'TF_CNML_CHECK'
MLUStatus mlu_status = (VA_ARGS);
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1932:3: note: in expansion of macro 'CNML_RETURN_STATUS'
CNML_RETURN_STATUS(cnmlComputePluginPowerDifferenceOpForward(
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1933:76: error: too few arguments to function 'cnmlStatus_t cnmlComputePluginPowerDifferenceOpForward(cnmlBaseOp_t, cnmlTensor**, void**, int, cnmlTensor**, void**, int, cnrtQueue_t, void*)'
op, inputs_ptr, outputs_ptr, queue));
^
./tensorflow/stream_executor/mlu/mlu_api/lib_ops/util.h:135:29: note: in definition of macro 'TF_CNML_CHECK'
MLUStatus mlu_status = (VA_ARGS);
^
tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:1932:3: note: in expansion of macro 'CNML_RETURN_STATUS'
CNML_RETURN_STATUS(cnmlComputePluginPowerDifferenceOpForward(
^
In file included from ./tensorflow/core/platform/mlu.h:7:0,
from tensorflow/stream_executor/mlu/mlu_api/lib_ops/mlu_lib_ops.cc:16:
./third_party/mlu/include/cnplugin.h:1649:14: note: declared here
cnmlStatus_t cnmlComputePluginPowerDifferenceOpForward(
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 673.792s, Critical Path: 73.37s
INFO: 2561 processes: 2561 local.
FAILED: Build did NOT complete successfully

plugin_power_difference_kernel.mlu 实现问题

作者您好,首先感谢您作业和章节的分享!
然后我看完您的实验一banc算子的实现代码,并且按照您的代码 bash mask.sh编译后, 运行power_diff_test 得到的err rate =100% 我有些疑惑,我想请教您以下2个问题:

  1. __bang_mul(temp_nram,temp_nram,temp_nram,ONELINE);
    我认为应该设置一个temp 和一个res
    temp = input1 - input2
    res = input1 - input2
    如果只用temp的话
    temp = input1-input2
    temp =temp * temp
    函数改成__bang_mul(res,temp_nram,res,ONELINE);这样?
    res = res * temp
  2. __bang_active_abs(temp_nram,temp_nram,ONELINE);请问为什么要绝对值呢?
    if x < y ,(x-y)^3 不是负的吗?
    希望不吝赐教 谢谢!

[Error]How to solve the error : AttributeError: 'module' object has no attribute 'power_difference'

WARNING:tensorflow:From power_difference_test_bcl.py:10: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

CNML: 7.2.1 c8ada41
CNRT: 4.2.1 fa5e44c
CNML: 7.2.1 c8ada41
CNML: 7.2.1 c8ada41
2020-12-05 05:24:10.892081: I tensorflow/stream_executor/mlu/mlu_stream_executor.cc:470][112186] MLU OP Cache enabled
CNML: 7.2.1 c8ada41
2020-12-05 05:24:10.892249: I tensorflow/core/common_runtime/mlu/mlu_device.cc:396][112186] __LOG_MLU__, Current MLU_Visible_Devices Count: 1
2020-12-05 05:24:10.892410: I tensorflow/core/common_runtime/mlu/mlu_device.cc:115][112186] __LOG_MLU__, save_offline_model: 0
2020-12-05 05:24:10.892487: I tensorflow/core/common_runtime/mlu/mlu_device.cc:121][112186] __LOG_MLU__, core_version: MLU270
2020-12-05 05:24:10.892584: I tensorflow/core/common_runtime/mlu/mlu_device.cc:123][112186] __LOG_MLU__, core_num: 1
Traceback (most recent call last):
  File "power_difference_test_bcl.py", line 36, in <module>
    main()
  File "power_difference_test_bcl.py", line 22, in main
    res = power_difference_op(input_x, input_y, input_pow)
  File "power_difference_test_bcl.py", line 12, in power_difference_op
    out = tf.power_difference()
  File "/opt/AICSE-demo-student/env/tensorflow-v1.10/virtualenv_mlu/local/lib/python2.7/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 106, in __getattr__
    attr = getattr(self._dw_wrapped_module, name)
AttributeError: 'module' object has no attribute 'power_difference'

↑This error appears when executing “
.../online_mlu/power_difference_test_bcl.py”

import numpy as np
import os
import time
os.environ['MLU_VISIBLE_DEVICES']="0"
import tensorflow as tf
np.set_printoptions(suppress=True)
from power_diff_numpy import *

def power_difference_op(input_x, input_y, input_pow):
        with tf.Session() as sess:

                out = tf.power_difference()
                return sess.run(out, feed_dict = {x:input_x, y:input_y, pow:input_pow})

def main():
        value = 256
        input_x = np.random.randn(1,value,value,3)
        input_y = np.random.randn(1,1,1,3)
        input_pow = np.zeros((2))

        start = time.time()
        res = power_difference_op(input_x, input_y, input_pow)
        end = time.time() - start
        print("comput BCL op cost "+ str(end*1000) + "ms" )

        start = time.time()
        output = power_diff_numpy(input_x, input_y,len(input_pow))
        end = time.time()
        res = np.reshape(res,(-1))
        output = np.reshape(output,(-1))
        print("comput op cost "+ str((end-start)*1000) + "ms" )
        err = sum(abs(res - output))/sum(output)
        print("err rate= "+ str(err*100))

if __name__ == '__main__':
        main()

Could you tell me how to fix it? 谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.