tuxu / magnetic_pendulum

OpenCL implementation of a magnetic pendulum
http://blog.tinowagner.com/2009/11/23/magnetic-pendulum-the-opencl-way/
2 stars 1 forks source link

Strange output image #1

Open jorenham opened 6 years ago

jorenham commented 6 years ago

First of all, awesome project! When I run the OpenCL code with

const float phi_from = 0.0, phi_to = 2 * M_PI;
const float theta_from = 0.5 * M_PI, theta_to = M_PI;
const int phi_steps = 400, theta_steps = 400;
unsigned char colors[3 * 3] = {255, 0, 0,
                               0, 255, 0,
                               0, 0, 255 };
const float friction = 0.1;
const int exponent = 2;
const unsigned int n_magnets = 3;
float alphas[n_magnets] = { 1.0, 1.0, 1.0 };
float rns[3 * n_magnets] = { -0.8660254, -0.5, -1.3,
                              0.8660254, -0.5, -1.3,
                              0.0, 1.0, -1.3 };
const float time_step = 5.0f;
const float min_kin = 0.5f;
const int max_iterations = 30;

I get the following output image (in <1s :tada: )

output

and I expected to get

screenshot from 2018-07-22 22-16-08

which is from your slides.

Is there something wrong going on here or am I missing something?

tuxu commented 6 years ago

Thanks for your interest in the project! I think there might be some problems with code compatibility between different graphic cards and their drivers on different operating systems. I tested the code back then with an Nvidia GTS 250 on MacOS X and Windows. Which system are you using?

jorenham commented 6 years ago

@tuxu I'm using an Nvidia 1050 TI on Ubuntu. I tried to compile it using g++ and gcc, but that yielded the same results.