로프필드의 도서관 - 페이지 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는 이 TensorFlow 바이너리가 사용하도록 컴파일되지 않은 명령을 지원합니다: AVX AVX2 "라는 메시지도 새 프로세서에 나타납니다. 이것은 TensorFlow의 알려진 버그입니다. 이것은 Python 버전과 관련이 없습니다.

Python에서 "...not load dll..."과 같은 또 다른 메시지가 있습니다.


그래서 그렇습니다 ... 그러나 아아, 랩톱에는 다른 "프로세서 코어"가 설치되어 있습니다. 랩톱에 i3 및 GForce 비디오가 있습니다. 실수가 아니라면 랩톱은 3-4년 된 장난감입니다. "날아라" 잘, 하지만 AVE와 함께 그것은 단지 공개

 

@Roffield , 좋은 오후입니다.

라이브러리를 설치하고 첫 번째 확인 오류를 즉시 포착했습니다.

 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. 나는 고문을 매달아, 결과는 정확하다. 출력은 아래와 같습니다.


바르게! 결과는 251920입니다. 올바른 출력입니다!

2. 나는 고문을 제거하고 다시 걸었다. 아래 출력:



3. 세 번째 또는 네 번째로 어드바이저가 충돌합니다.

이 문제는 무엇이며 어떻게 해결할 수 있습니까? 어디를 봐야 할까요?

감사해요

 
  • pyFinalize()를 호출하여 메모리를 해제하는 것은 의미가 있지만 인기 있는 NumPy 라이브러리의 버그로 인해 수행할 가치가 없습니다. 이슈8097 , 이슈34309

인기 있는 라이브러리를 사용할 때 충돌이 불가피합니다. 충돌은 코드가 실행될 때가 아니라 완료 및 새 실행 시점에 정확하게 발생합니다. 새 코드 실행을 위해 터미널을 다시 시작하는 것이 더 쉽습니다. 완료 전에 터미널을 종료하면 테스터가 중단될 수 있습니다.

크래시 덤프는 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() 를 배치할 수도 있습니다. 이는 변수 값을 제어하는 가장 쉬운 방법입니다. 콘솔을 활성화할 수 있습니다.