Go Back   AC3D Forums > General > AC3D Suggestions
Register FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Display Modes
Old 22nd December 2020, 09:04 AM   #1
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,565
Default Re: Overall support for multicore cpu

That's interesting. Do you mean that it doesn't link or doesn't load or doesn't run?
Andy is offline   Reply With Quote
Old 22nd December 2020, 12:08 PM   #2
modeler
Member
Advanced member
 
Join Date: Nov 2003
Posts: 35
Default Re: Overall support for multicore cpu

The program crashes. This code is part of an importer. It works on the first import but crashes on the second import.
#pragma omp parallel
for (int n = 0; n < (int)num_vertices; n++)
{
Vertex *vtemp;
v.x = vert[n].v[0];
v.y = vert[n].v[1];
v.z = vert[n].v[2];
vtemp = object_find_vertex_point(ob, &v);
vindex[n] = ac_object_get_vertex_index(ob, vtemp);

}
modeler is offline   Reply With Quote
Old 26th December 2020, 11:48 AM   #3
modeler
Member
Advanced member
 
Join Date: Nov 2003
Posts: 35
Default Re: Overall support for multicore cpu

I got it to work. I missed one of the variables that has to be included inside the for loop.

int cores = (int)num_vertices / 100;
if (cores == 0)
cores = 1;
if (cores > omp_get_num_procs())
cores = omp_get_num_procs();
int m;

#pragma omp parallel for num_threads (cores) private(m)
for (m = 0; m < (int)num_vertices; m++)
{
Point3 v;
Vertex *vtemp;
v.x = vert[m].v[0];
v.y = vert[m].v[1];
v.z = vert[m].v[2];
vtemp = object_find_vertex_point(ob, &v);
vindex[m] = ac_object_get_vertex_index(ob, vtemp);
}

Last edited by modeler; 27th December 2020 at 11:29 AM.
modeler is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 12:35 PM.


AC3D Forum
(C) Inivis Limited 2020