@@ -18,9 +18,9 @@ __device__ void _eye(double *data);
18
18
* T: double(N, 4, 4) the final transform matrix of all points (shared)
19
19
* tool: double(N, 4, 4) the tool transform matrix of all points (shared)
20
20
* nlinks_pt: long(N,): the number of links associated with each (shared)
21
- * link_A: double(nlinks , 4, 4) the transformation matrix of all joints
22
- * link_axes: long(nlinks , ): axes of all links
23
- * link_isjoint: long(nlinks , ): 1/0 whether links are joints
21
+ * link_A: double(max_nlinks , 4, 4) the transformation matrix of all joints
22
+ * link_axes: long(max_nlinks , ): axes of all links
23
+ * link_isjoint: long(max_nlinks , ): 1/0 whether links are joints
24
24
* N: (int) number of points
25
25
* njoints: (int) number of joints
26
26
* out: (N, 6, njoints)
@@ -33,7 +33,6 @@ __global__ void _jacob0(double *T,
33
33
long *link_axes,
34
34
long *link_isjoint,
35
35
int N,
36
- int nlinks,
37
36
int njoints,
38
37
double *out)
39
38
{
@@ -63,7 +62,7 @@ __global__ void _jacob0(double *T,
63
62
return ;
64
63
}
65
64
66
- // int nlinks = nlinks_pt[tid];
65
+ int nlinks = nlinks_pt[tid];
67
66
// printf("Hello from tid %d nlinks %d\n", tid, nlinks);
68
67
for (int i = 0 ; i < nlinks; i++) {
69
68
// printf("Hello from tid %d link_i %d link_axis %ld isjoint %ld \n", tid, i, link_axes[i], link_isjoint[i]);
@@ -358,11 +357,11 @@ extern "C"{
358
357
* T: double(N, 4, 4) the final transform matrix of all points (shared)
359
358
* tool: double(N, 4, 4) the tool transform matrix of all points (shared)
360
359
* nlinks_pt: long(N,): the number of links associated with each (shared)
361
- * link_A: double(nlinks , 4, 4) the transformation matrix of all joints
362
- * link_axes: long(nlinks , ): axes of all links
363
- * link_isjoint: long(nlinks , ): 1/0 whether links are joints
360
+ * link_A: double(max_nlinks , 4, 4) the transformation matrix of all joints
361
+ * link_axes: long(max_nlinks , ): axes of all links
362
+ * link_isjoint: long(max_nlinks , ): 1/0 whether links are joints
364
363
* N: (int) number of points
365
- * nlinks : (int) max number of links on the path
364
+ * max_nlinks : (int) max number of links on the path
366
365
* njoints: (int) number of joints
367
366
* out: (N, 6, njoints)
368
367
*/
@@ -374,7 +373,7 @@ void jacob0(double *T,
374
373
long *link_axes,
375
374
long *link_isjoint,
376
375
int N,
377
- int nlinks ,
376
+ int max_nlinks ,
378
377
int njoi
10000
nts,
379
378
double *out)
380
379
{
@@ -385,21 +384,21 @@ void jacob0(double *T,
385
384
cudaMalloc ((void **)&d_T, sizeof (double ) * N * 16 );
386
385
cudaMalloc ((void **)&d_tool, sizeof (double ) * N * 16 );
387
386
cudaMalloc ((void **)&d_etool, sizeof (double ) * N * 16 );
388
- cudaMalloc ((void **)&d_link_A, sizeof (double ) * nlinks * 16 );
387
+ cudaMalloc ((void **)&d_link_A, sizeof (double ) * max_nlinks * 16 );
389
388
cudaMalloc ((void **)&d_nlinks_pt, sizeof (long ) * N);
390
- cudaMalloc ((void **)&d_link_axes, sizeof (long ) * nlinks );
391
- cudaMalloc ((void **)&d_link_isjoint, sizeof (long ) * nlinks );
389
+ cudaMalloc ((void **)&d_link_axes, sizeof (long ) * max_nlinks );
390
+ cudaMalloc ((void **)&d_link_isjoint, sizeof (long ) * max_nlinks );
392
391
cudaMalloc ((void **)&d_out, sizeof (double ) * N * 6 * njoints);
393
392
394
393
395
394
// Transfer data from host to device memory
396
395
cudaMemcpy (d_T, T, sizeof (double ) * N * 16 , cudaMemcpyHostToDevice);
397
396
cudaMemcpy (d_tool, tool, sizeof (double ) * N * 16 , cudaMemcpyHostToDevice);
398
397
cudaMemcpy (d_etool, etool, sizeof (double ) * N * 16 , cudaMemcpyHostToDevice);
399
- cudaMemcpy (d_link_A, link_A, sizeof (double ) * nlinks * 16 , cudaMemcpyHostToDevice);
398
+ cudaMemcpy (d_link_A, link_A, sizeof (double ) * max_nlinks * 16 , cudaMemcpyHostToDevice);
400
399
cudaMemcpy (d_nlinks_pt, nlinks_pt, sizeof (long ) * N, cudaMemcpyHostToDevice);
401
- cudaMemcpy (d_link_axes, link_axes, sizeof (long ) * nlinks , cudaMemcpyHostToDevice);
402
- cudaMemcpy (d_link_isjoint, link_isjoint, sizeof (long ) * nlinks , cudaMemcpyHostToDevice);
400
+ cudaMemcpy (d_link_axes, link_axes, sizeof (long ) * max_nlinks , cudaMemcpyHostToDevice);
401
+ cudaMemcpy (d_link_isjoint, link_isjoint, sizeof (long ) * max_nlinks , cudaMemcpyHostToDevice);
403
402
cudaMemcpy (d_out, out, sizeof (double ) * N * 6 * njoints, cudaMemcpyHostToDevice);
404
403
405
404
@@ -414,7 +413,6 @@ void jacob0(double *T,
414
413
d_link_axes,
415
414
d_link_isjoint,
416
415
N,
417
- nlinks,
418
416
njoints,
419
417
d_out);
420
418
0 commit comments