ロフィルドの図書館 - ページ 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でも「Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2」というメッセージが表示される。これはTensorFlowの既知のバグである。Pythonのバージョンとは関係ありません。

Pythonから「...not load 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を取りあげました。ただ、call-resultをテストしてみることにしました。トゥック、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.Expert Advisor を取り外して、再度装着しています。出力は以下のとおりです。



3回目、4回目にExpert Advisorがクラッシュします。

何が問題で、どうすれば解決できるのか。どうすればいいんだ?

ありがとうございました。

 
  • メモリを解放するために pyFinalize() を呼び出すことは理にかなっていますが、人気のある NumPy ライブラリのバグのために、あなたはそれを行うべきではありません。

人気のあるライブラリを使用すると、クラッシュは避けられない。クラッシュは、コード実行中ではなく、終了して新たに開始する瞬間に正確に発生します。新しいコード実行のために端末を再起動するのは簡単です。完了する前に端末を終了させると、テスターがハングアップする場合があります。

Crashdumps can accumulate inc:╱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
 

OK、ありがとうございました。

自分の持っているもので仕事をする。

 

血の涙が出そうです!

一行ずつ関数コードを書こうとしている。

何が起きたのか。

    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() を配置することもできます。これは、変数の値を制御する最も簡単な方法です。コンソールを起動することができます。