MacOS OpenCL not working for Mandelboxes (but works with other fractals)

  • 19 Replies
  • 542 Views

0 Members and 1 Guest are viewing this topic.

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« on: February 08, 2020, 10:53:54 PM »
OpenCL on the Mac (MacOS Mojave) produces errors and will not render, but ONLY for the various mandelbox fractals.

The other fractal examples like the dodecahedron, icosahedron, mandelbulb power 2, mandelbulb power 9, menger sponge, octahedron, and quaternion all render just fine (and fast!) with OpenCL enabled. But no mandelbox will render. Instead I get the error:

Code: [Select]
Error: Error during compilation of OpenCL program
Device #0
OpenCL Build log:
Error returned by cvms_element_build_from_source

My current Mac system is a 27" iMac (2019) 3.7 GHz Intel Core i5, 24GB RAM, Radeon Pro 580X 8 GB GPU. Mandelbulber is the stable release 2.20.

Note that OpenCL works fine on my old Windows box with a GeForce GTX 750Ti running Mandelbulber release 2.20.

Again, this OpenCL problem only exists for mandelboxes and not for the other fractals. Any help would be much appreciated. Happy to troubleshoot it more if I can. BTW, I've already tried changing the OpenCL options of disabling the OpenCl cache and changing the memory limits and the job size multiplier.

Linkback: https://fractalforums.org/mandelbulber/14/macos-opencl-not-working-for-mandelboxes-but-works-with-other-fractals/3312/

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 771
« Reply #1 on: February 09, 2020, 05:50:16 AM »
wierd,  does this include all abox and amazing surf formulas?

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #2 on: February 09, 2020, 04:59:47 PM »
Yes, the Abox and Amazing Surf formulas I've tried so far all work and render fine under OpenCL. Interestingly, the only mandelbox ones that seem to work are "Mandelbox - Vary Scale 4D" and "Mandelbox - Smooth." All other mandelbox formulas error out. Even  "Mandelbox - Variable" errors out, but with a slightly different error:

Code: [Select]
Error: Error during compilation of OpenCL program
Device #0
OpenCL Build log:
In file included from <program source>:39:
/Applications/mandelbulber2.app/formula/opencl/mandelbox_variable.cl:192:10: error: Cannot downconvert and widen scalar type 'double' to vector type '__float4'
                tempVC *= M_PI_180;
  ~~~~~~ ^  ~~~~~~~~

So it seems that there's something that OpenCL doesn't like about the mandelbox's code, except for the two variants I listed ("Mandelbox - Vary Scale 4D" and "Mandelbox - Smooth"). If it's helpful to anyone, "Fold Box - Mod 1" works, which seems somewhat close to a classic mandelbox.

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 771
« Reply #3 on: February 10, 2020, 03:15:26 AM »
thanks for the testing information

I have made an issue at github

https://github.com/buddhi1980/mandelbulber2/issues/762

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #4 on: February 10, 2020, 03:27:22 AM »
Much appreciated, mclarekin! Hopefully some of the other devs (buddhi? Krzysztof Marczak?) will see it and weigh in. Weird that the most classic formula, the Mandelbox, won't work in OpenCL on MacOS, but all the others will.

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 771
« Reply #5 on: February 10, 2020, 11:24:29 AM »
i am guessing


a)with the Mandelbox  and Mandellbox -Menger,   it is in the code for   Rotation of Separate Planes

You could try a hybrid including T>Rotation Folding Planes  to possibly confirm

b) and the Mandlbox Variable is what you posted

Quote
/Applications/mandelbulber2.app/formula/opencl/mandelbox_variable.cl:192:10: error: Cannot downconvert and widen scalar type 'double' to vector type '__float4'
                tempVC *= M_PI_180;

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #6 on: February 11, 2020, 02:59:06 AM »
Unfortunately, I don't understand how to properly use T>Rotation Folding Plane or hybrid fractals. If I select T>Rotation Folding Plane as the formula, I just get a largely featureless rendering with it. However, it does NOT error out in either CPU-based rendering or in OpenCL rendering.

And yes, I was pointing out that "Mandelbox - Variable" generates an OpenCL error, but a different error than the others.

As far as I can tell, the results of Mandelbox and the results of Fold Box - Mod 1 produce the same mathematical and visual results, but Mandelbox doesn't work under OpenCL whereas Fold Box - Mod 1 does work under OpenCL.

I don't know if that helps you with the troubleshooting.


Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 771
« Reply #7 on: February 11, 2020, 07:40:14 AM »
thanks for testing  T>Rotation Folding Plane, unfortunatelly I expected it not to compile, so the issue is more confusing.


BTW  "Objects tab - hybrids - enable hybrid fractals" allows you to build or hybridize fractals.  Here is the Mandelbox built from transforms ( T>somethings). You can  copy this to clipboard then in Mandelbulber  go to "File - Load settings from clipboard"

Quote
# Mandelbulber settings file
# version 2.20
# only modified parameters
[main_parameters]
ambient_occlusion 0.5;
ambient_occlusion_enabled true;
camera 17.10225536618564 5.181464580812182 0.3197785837136274;
camera_distance_to_target 11.95801639556885;
camera_rotation 113.4982682256923 4.261031429509198 -0.8588937553330075;
camera_top 0.07410807445115961 0.0158749879984855 0.9971238529175748;
detail_level 1.333333333333333;
flight_last_to_render 0;
formula_1 1020;
formula_2 1021;
formula_3 1003;
formula_4 1007;
hdr true;
hybrid_fractal_enable true;
image_proportion 2;
keyframe_last_to_render 0;
main_light_alpha 0;
main_light_beta 0;
mat1_fractal_coloring_algorithm 2;
mat1_fractal_coloring_extra_color_options_false true;
mat1_fractal_coloring_rad_div_de_scale1 0;
mat1_is_defined true;
mat1_specular_metallic 0.5;
mat1_specular_plastic_enable false;
mat1_surface_color_gradient 0 fd6029 1000 698403 2000 fff59b 3000 aa0000 4000 ffff00 5000 c68876 6000 a51c64 7000 aa0000 8000 d4ffd4 9000 aba53c;
target 6.16620399054635 0.4267271414851663 1.208265110979655;
[fractal_2]
analyticDE_enabled_false true;
[fractal_3]
analyticDE_enabled_false true;
analyticDE_offset_1 0.9999999999999999;
transf_scale 2;

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #8 on: February 12, 2020, 01:58:02 PM »
Thanks! That sample file helps a lot. I'll try it out when I get home and let you know what happens.

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #9 on: February 13, 2020, 03:30:55 AM »
Just tried the example of the hybrid fractal you posted. It renders just fine in OpenCL. No errors at all.

Offline mclarekin

  • *
  • Fractal Freak
  • **
  • Posts: 771
« Reply #10 on: February 13, 2020, 09:19:38 AM »
the Mandelbox issues are probably now fixed, thank you for bringing it to our attention. There are somethings that need to be done differently with MacOS , and as none of us use a mac we can easily miss these things.


Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #12 on: February 14, 2020, 03:18:16 AM »
Thanks for the effort mclarekin and buddhi, but the problem remains with those two models in that latest build. Formula "Mandelbox" under OpenCL still generates the error:

Code: [Select]
Error: Error during compilation of OpenCL program
Device #0
OpenCL Build log:
Error returned by cvms_element_build_from_source

Same error for fomula Mandelbox - Menger.

But (as before) the following mandelbox formulae render just fine in OpenCL:

Mandelbox - Smooth
Mandelbox - Variable
Mandelbox - Vary Scale 4D

Offline buddhi

  • *
  • Fractal Feline
  • **
  • Posts: 152
    • Mandelbulber GitHub repository
« Reply #13 on: February 14, 2020, 07:57:21 PM »
Probably this part of code fails to compile:
Code: [Select]
if (fractal->mandelbox.rotationsEnabled)
{
REAL4 zRot;
// cast vector to array pointer for address taking of components in opencl
REAL *zRotP = (REAL *)&zRot;
__constant REAL *colP = (__constant REAL *)&fractal->mandelbox.color.factor;
for (int dim = 0; dim < 3; dim++)
{
// handle each dimension x, y and z sequentially in pointer var dim
REAL *rotDim = (dim == 0) ? &zRotP[0] : ((dim == 1) ? &zRotP[1] : &zRotP[2]);
__constant REAL *colorFactor = (dim == 0) ? &colP[0] : ((dim == 1) ? &colP[1] : &colP[2]);

zRot = Matrix33MulFloat4(fractal->mandelbox.rot[0][dim], z);
if (*rotDim > fractal->mandelbox.foldingLimit)
{
*rotDim = fractal->mandelbox.foldingValue - *rotDim;
z = Matrix33MulFloat4(fractal->mandelbox.rotinv[0][dim], zRot);
aux->color += *colorFactor;
}
else
{
zRot = Matrix33MulFloat4(fractal->mandelbox.rot[1][dim], z);
if (*rotDim < -fractal->mandelbox.foldingLimit)
{
*rotDim = -fractal->mandelbox.foldingValue - *rotDim;
z = Matrix33MulFloat4(fractal->mandelbox.rotinv[1][dim], zRot);
aux->color += *colorFactor;
}
}
}
}
But I have no clue why, especially when compiler error message does not contain any details.

Unfortunately OpenCL compiler on MacOS has a lot of bugs. If you google this topic then you will see a lot of posts about problems:
https://streamhpc.com/blog/2015-05-09/apples-dragging-opencl-compiler-problem/
https://apple.slashdot.org/story/18/06/05/1719205/apple-deprecates-opengl-and-opencl-in-macos-1014-mojave

Offline fpsurgeon

  • *
  • Fractal Friend
  • **
  • Posts: 14
« Reply #14 on: February 15, 2020, 10:00:36 PM »
Thanks, buddhi. Yes, I've heard about the MacOS issues with OpenCL. I don't know if there's a way to enable more verbose logging of the compiler error to help you, though.

Interestingly, the OpenCL benchmarking app LuxMark v3.1 compiles and renders its OpenCL demos just fine on the Mac with what I assume are the compiler flags enabled for cl-fast-relaxed-math, cl-mad-enable, cl-no-signed-zeros, and cl-strict-aliasing. I have no idea whether those OpenCL compiler options mean anything in the context of Mandelbulber, though. Just wanted to point that out if it's insightful.

If these problems prove intractable for Mandelbulber, am I right to assume that FoldBox Mod 1 produces the same output as the Mandelbox formula?


clip
OpenCL two cards configured, it works only one

Started by jeyjey on Mandelbulber

5 Replies
495 Views
Last post October 20, 2018, 01:33:34 AM
by mancoast
question
MacOS ?

Started by FractalDave on Mandelbulb3d

0 Replies
232 Views
Last post September 13, 2018, 05:22:06 PM
by FractalDave
xx
MacOS Mojave

Started by StigNasty on Mandelbulb3d

0 Replies
259 Views
Last post December 31, 2018, 07:30:43 AM
by StigNasty
xx
The question about the possibility to sell 3D works

Started by ER2 on Mandelbulb3d

7 Replies
682 Views
Last post July 06, 2018, 11:14:28 PM
by Bill Snowzell
xx
ArtFutura call for audiovisual works

Started by claude on Collaborations & Jobs

0 Replies
199 Views
Last post July 05, 2019, 01:33:14 AM
by claude