Roffilds Bibliothek - Seite 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:

Die Meldung"Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2" erscheint auch auf neueren CPUs. Dies ist ein bekannter Fehler in TensorFlow. Das hat nichts mit der Python-Version zu tun.

Es gibt eine weitere Meldung wie "...not load dll..." von Python


Das ist wahr... ich habe i3 und GForce Video, wenn ich mich nicht irre, ist der Laptop 3-4 Jahre alt, auch das Spielzeug fliegen gut, aber mit AVE gerade herausgefunden

 

@Roffild, guten Tag.

Ich habe Ihre Bibliothek installiert und den Fehler bei der allerersten Prüfung sofort bemerkt:

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

Auch die Variablen sind alle vorhanden.


Was habe ich noch vergessen zu tun?

Danke.

 
 

Ja, ich habe es herausgefunden.

Entschuldigung für die Dummheit.

 

Guten Tag.

Beginnen Sie mit den ersten Schritten zur Nutzung Ihrer Bibliothek. Nehmen wir als Beispiel PythonDLL_Example.mq5 und PythonDLL_Example.py. Ich habe gerade beschlossen, das Anrufergebnis zu testen. nahm, erstellte ein Array mit 11 Zahlen und übergab es an die Funktion. Bislang sah die Funktion in PythonDLL_Example.py wie folgt aus:

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

(meine erste Änderung ))) )Alles funktionierte, wie es sollte. Aufgrund der Tatsache, dass ich angefangen habe zu schreiben, wenn die Börse geschlossen ist, um die Funktion zu testen, habe ich den Aufruf zu int OnInit() Kein Problem, es funktioniert, wenn EA läuft.

Als Nächstes fügten wir einfach importierte Bibliotheken in die Datei PythonDLL_Example.py ein

Die Datei sah nun folgendermaßen aus:

# 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()

Das Folgende begann zu geschehen:

1. Ich hänge den EA auf, das Ergebnis ist korrekt. Die folgende Ausgabe.


Richtig! Das Ergebnis ist 251920 - das ist richtig!

2. Ich ziehe den Expert Advisor zurück und füge ihn wieder ein. Die Ausgabe ist unten dargestellt:



Beim dritten oder vierten Mal stürzt der Expert Advisor ab.

Was ist das Problem und wie kann es gelöst werden? Was muss ich tun?

Dankeschön

 
  • Der Aufruf von pyFinalize(), um Speicher freizugeben, ist sinnvoll, aber wegen eines Fehlers in der beliebten NumPy-Bibliothek sollte man es nicht tun. issue8097,issue34309

Abstürze sind bei der Verwendung beliebter Bibliotheken unvermeidlich. Abstürze treten genau in dem Moment auf, in dem ein Programm beendet und ein neues gestartet wird, nicht während der Codeausführung. Es ist einfacher, das Terminal für die Ausführung eines neuen Codes neu zu starten. Das Testgerät kann sich aufhängen, wenn Sie das Terminal vor der Fertigstellung beenden.

Crashdumps können sich inc:\Users\ \AppData\Local\CrashDumps ansammeln.

Das Problem liegt in Python selbst, oder vielmehr im Fehlen eines Mechanismus, der externe Bibliotheken über die Fertigstellung informiert.

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, vielen Dank.

Ich werde mit dem arbeiten, was ich habe.

 

Ich weine verdammte Tränen!

Eine Zeile nach der anderen versuchen, Funktionscode zu schreiben.

Was geschah:

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

Der Wert von x wird korrekt zurückgegeben! Das Ergebnis ist 251920

Was hinzugefügt wurde:

    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]

Der Wert von x ist falsch, das Ergebnis ist 3.211426697968103e-322

Ich habe mehrmals versucht, eine Zeichenfolge hinzuzufügen oder zu entfernen! Ich habe gerade die Datei mit der hinzugefügten Zeichenfolge gelesen! Sie beeinflusst die Berechnung von x in keiner Weise! Die Pandas-Bibliothek wird importiert.

Warum verhält sich das System so? Wo ist das Problem zu suchen?

Ich danke Ihnen! )

 
Sie können Code auch in PyCharm debuggen. Und Sie können print() auch an problematischen Stellen einsetzen - es ist der einfachste Weg, um Variablenwerte zu kontrollieren. Die Konsole kann aktiviert werden.
Grund der Beschwerde: