Features of the mql5 language, subtleties and tricks - page 306

 
Nikolai Semko #:
There's nothing to determine.
I'm optimising.
 
fxsaber #:
I'm optimising.
What do you mean, optimising? Gegetic overshoot or something more serious?

In any case, connecting the GPU's computational capabilities (OpenCL) will give a powerful jump in performance.
 
Nikolai Semko #:
What do you mean, optimising? Hegetic overshoot or something more serious?

Either way, tapping into the computational power of the GPU (OpenCL) will give a massive performance boost.

I do exactly what everyone else does - write a TC and investigate. If the process can be accelerated, I look at it.

 
Nikolai Semko #:

Here are all the files for playback

For CPU works

For GPU only shows FPS line

For OCL missing test_002.cl

 
Edgar Akhmadeev #:

For the CPU, it works

For GPU only shows the FPS line

For OCL missing test_002.cl

oh yes, I apologise
this is the file

Files:
test_002.zip  1 kb
 
Edgar Akhmadeev #:

For GPU only shows the FPS line

in the pixel1.hlsl file, delete the first ё character that was accidentally there.

 
Edgar Akhmadeev #:

For the CPU, it works

For GPU only shows the FPS line

For OCL missing test_002.cl

And the more "centres of gravity", the greater the gain (I have about 100 times at 300 centres of gravity)
GPU version (DirectX) I somehow became slower than the CPU, although before it was several times faster.

 
Nikolai Semko #:

in the pixel1.hlsl file, delete the first character ё, which accidentally appeared there.

It worked.

I couldn't find where this resource pixel1.hlsl is inserted.

For CL it is displayed incorrectly - there are occasional flashes of colour on a light grey background.

 
#define  TOSTRING(A) TOSTRING2(A)
#define  TOSTRING2(A) #A

int Num1 = 123;
int Num2 = 456;
int Num3 = 789;

#define  MACROS1 Num1
#define  MACROS2 Num2, Num3

void f( int i, int j = 0 ) { Print((string)i + "," + (string)j); }

void OnStart()
{
  f(MACROS1); // 123,0
  f(MACROS2); // 456,789
  
  Print(TOSTRING(MACROS1)); // Num1
  Print(TOSTRING(MACROS2)); // Num2: too many arguments for function-like macro 'TOSTRING2'
}

Is it possible to output fully MACROS2: Num2,Num3 at this point?

 
fxsaber #:

Is it possible to output fully MACROS2: Num2,Num3 at this point?


#define  TOSTRING(A) TOSTRING2(A)
#define  TOSTRING2(A) #A

#define  TOSTRING_2P(AB) TOSTRING_2P2(AB)
#define  TOSTRING_2P2(A,B) TOSTRING2(A) ", " TOSTRING2(B)

int Num1 = 123;
int Num2 = 456;
int Num3 = 789;

#define  MACROS1  Num1
#define  MACROS2  Num2, Num3
#define  SPLIT(x) Num2, Num3

void f( int i, int j = 0 ) { Print((string)i + "," + (string)j); }

void OnStart()
{
  f(MACROS1); // 123,0
  f(MACROS2); // 456,789

  Print(TOSTRING(MACROS1));    // Num1
  Print(TOSTRING_2P(MACROS2)); // Num2, Num3
}

Spliting, concat and stringizing nested macro parameters requires another (indirection) 2nd level macro.