Skip to content

Commit

Permalink
threadid now PDL_Indx so malloc that size not int
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed May 1, 2021
1 parent 2b752b2 commit bee5a35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Basic/Core/pdlthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void pdl_initthreadstruct(int nobl,
MAX2(nids,pdls[j]->nthreadids);
MAX2(mx,pdls[j]->threadids[0] - realdims[j]);
}
nthreadids = pdl_malloc(sizeof(int)*nids);
nthreadids = pdl_malloc(sizeof(PDL_Indx)*nids);
ndims += mx; nimpl = mx; thread->nimpl = nimpl;


Expand Down
14 changes: 7 additions & 7 deletions t/thread.t
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,15 @@ $pa->doflow;
# $pa->jdump;
my $a2 = pdl 1;
my $pb = $pa + $a2;
ok("$pb" eq <<END);
is("$pb", <<END, 'pb doflow');
[
[3 4 5]
[6 7 8]
]
END
my $pc = $pb * 2; # This should stay the same flowed structure.
ok("$pc" eq <<END);
is("$pc", <<END, 'multiplied');
[
[ 6 8 10]
Expand All @@ -369,21 +369,21 @@ $pc->make_physical();
maximum($pa->thread(0,1),$pc);
# print "B:\n"; $pb->dump(); print "C:\n";$pc->dump();
# print $pb;
cmp_ok($pb->at(0,0), '==', 10);
cmp_ok($pb->at(1,1), '==', 14);
cmp_ok($pb->at(0,0), '==', 10, 'at(0,0)');
cmp_ok($pb->at(1,1), '==', 14, 'at(1,1)');
# print "B:\n"; $pb->dump(); print "C:\n";$pc->dump();
minimum($pa->thread(0,1),$pb->thread(0,1));
# print $pb;
cmp_ok($pb->at(0,0), '==', 0);
cmp_ok($pb->at(1,1), '==', 4);
cmp_ok($pb->at(0,0), '==', 0, 'at(0,0)');
cmp_ok($pb->at(1,1), '==', 4, 'at(1,1)');
}

{
# Now, test 'unthread'.
my $pa = zeroes(4,5,6);
my $pb = $pa->thread(1);
my $pc = $pb->unthread(2);
ok((join ',',$pc->dims) eq "4,6,5");
is(join(',',$pc->dims), "4,6,5", 'unthread dims');
# $pb->jdump; $pc->jdump;
}

Expand Down

0 comments on commit bee5a35

Please sign in to comment.