罗菲德的图书馆 - 页 10

 
Advanced Vector Extensions - Wikipedia
  • en.wikipedia.org
AVX2 expands most integer commands to 256 bits and introduces fused multiply-accumulate (FMA) operations. AVX-512 expands AVX to 512-bit support using a new EVEX prefix encoding proposed by Intel in July 2013 and first supported by Intel with the Knights Landing processor, which shipped in 2016.[3][4] AVX uses sixteen YMM registers. Each YMM...
 
Roffild:

在较新的CPU上也会出现"你的CPU支持的指令,这个TensorFlow二进制文件没有被编译为使用:AVX AVX2"的信息。这是TensorFlow的一个已知错误。这与Python版本没有关系。

在Python中还有一条类似"......无法加载dll...... "的信息


这倒是真的...我有i3和GForce视频,如果我没记错的话,这台笔记本已经有3-4年的历史了,连玩具都飞得很好,但用AVE才发现

 

@Roffild,下午好。

安装了你的库,立即发现了第一个检查的错误。

2019.07.09 21:56:43.540 PythonDLL_Example (USDRUB,D1)   ERROR: PythonHome == ""

变量也都到位了。


我还忘记做什么了?

谢谢。

 
 

是的,我已经得到了它。

对愚蠢的行为感到抱歉。

 

下午好。

开始了使用你的图书馆的第一个步骤。以PythonDLL_Example.mq5和PythonDLL_Example.py为例。只是决定测试一下调用结果。取,做了一个11个数字的数组,并把它传给了函数。到目前为止,PythonDLL_Example.py中的函数看起来像。

    def getDouble(self, magic: int, value: float, array: tuple) -> tuple or list:
        x = array[2] + array[1]
        return [x]

(我的第一个改变)))一切都像它应该的那样工作。由于我是在交易所关闭时开始写的,为了测试这个函数,我把调用移到了int OnInit()没有问题,在EA运行时它是有效的。

接下来,开始简单地在PythonDLL_Example.py文件中添加导入的库

文件开始看起来像这样。

# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# https://github.com/Roffild/RoffildLibrary
# ==============================================================================

import pandas as pd

import numpy as np

import tensorflow as tf
from tensorflow import keras

import sys
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

class PythonDLL_Example():
    def getLong(self, magic: int, value: int, array: tuple) -> tuple or list:
        raise NotImplementedError

    def getULong(self, magic: int, value: int, array: tuple) -> tuple or list:
        raise NotImplementedError

    def getDouble(self, magic: int, value: float, array: tuple) -> tuple or list:
        x = array[2] + array[1]
        return [x]

    def getString(self, magic: int, value: str, array: bytes) -> str:
        if magic == 1:
            return value + str(sys.version)
        if magic == 2:
            return str(array) + " " + str(sys.version_info)
        if magic == 3:
            return "sys.path:\n" + "\n".join(sys.path) + \
                   "os.environ[\"PATH\"]:\n" + os.environ["PATH"].replace(";", "\n")
        raise Exception("This is not a bug! This is a feature :D")


__mql__ = PythonDLL_Example()

以下情况开始发生。

1.我挂了EA,结果是正确的。下面的输出。


正确的!结果是251920 - 这是正确的!

2.我撤回专家顾问,并重新将其连接。输出如下所示。



在第三次或第四次时,专家顾问崩溃了。

问题是什么,如何解决?我必须要做什么?

谢谢你

 
  • 调用pyFinalize()来释放内存是有道理的,但由于流行的NumPy库有一个错误,你不应该这样做。issue8097,issue34309

在使用流行的库时,崩溃是不可避免的。崩溃恰恰发生在结束和开始新的时刻,而不是在代码执行期间。重新启动终端以执行新的代码更容易。如果你在完成之前杀死终端,测试器可能会挂起。

崩溃转储可以在c:\Users\ \AppData\Local\CrashDumps 中积累。

问题出在Python本身,或者说是缺乏一种机制来通知外部库的完成。

Crash when importing numpy from the Python C-API after calling Py_Finilize() · Issue #8097 · numpy/numpy
Crash when importing numpy from the Python C-API after calling Py_Finilize() · Issue #8097 · numpy/numpy
  • numpy
  • github.com
New issue Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account
 

好的,非常感谢你。

我将用我所得到的来工作。

 

我正在哭得血泪斑斑!"。

一行一行地尝试写功能代码。

发生了什么事。

    def getDouble(self, magic: int, value: float, array: tuple) -> tuple or list:
        x = array[2] + array[1]
        return [x]

x的值被正确地返回!结果是251920

增加了什么。

    def getDouble(self, magic: int, value: float, array: tuple) -> tuple or list:
        x = array[2] + array[1]
        df = pd.read_csv("RTSSplice.csv", usecols=['Low', 'Open', 'Close', 'High', 'Volume', 'Indicator1', 'Indicator2', 'Indicator3', 'Indicator4', 'Indicator5', 'Indicator6', 'Indicator7'], encoding='utf-16')
        return [x]

x的值返回不正确!结果是3.211426697968103e-322

试着添加-删除一个字符串几次!我刚刚读到了添加了字符串的 文件!它不会以任何方式影响x的计算!pandas库被导入。

为什么系统会出现这样的行为?去哪里找问题?

谢谢你!)

 
你也可以在PyCharm中调试代码。而且你也可以把print() 放在有问题的地方--这是控制变量值的最简单方法。控制台可以被激活。