"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Core/pdlutil.c" between
PDL-2.074.tar.gz and PDL-2.075.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

pdlutil.c  (PDL-2.074):pdlutil.c  (PDL-2.075)
skipping to change at line 117 skipping to change at line 117
return pdl_make_error(PDL_EUSERERROR, "%s", message); return pdl_make_error(PDL_EUSERERROR, "%s", message);
} }
void pdl_print_iarr(PDL_Indx *iarr, int n) { void pdl_print_iarr(PDL_Indx *iarr, int n) {
int i; int i;
printf("("); printf("(");
for (i=0;i<n;i++) printf("%s%"IND_FLAG,(i?" ":""),iarr[i]); for (i=0;i<n;i++) printf("%s%"IND_FLAG,(i?" ":""),iarr[i]);
printf(")"); printf(")");
} }
void pdl_dump_thread(pdl_thread *thread) { void pdl_dump_broadcast(pdl_broadcast *broadcast) {
int i, j, found=0, sz=0; int i, j, found=0, sz=0;
char spaces[] = " "; char spaces[] = " ";
int flagval[] = { int flagval[] = {
#define X(f) f, #define X(f) f,
PDL_LIST_FLAGS_PDLTHREAD(X) PDL_LIST_FLAGS_PDLBROADCAST(X)
#undef X #undef X
0 0
}; };
char *flagchar[] = { char *flagchar[] = {
#define X(f) #f, #define X(f) #f,
PDL_LIST_FLAGS_PDLTHREAD(X) PDL_LIST_FLAGS_PDLBROADCAST(X)
#undef X #undef X
NULL NULL
}; };
int paramflagval[] = { int paramflagval[] = {
#define X(f) f, #define X(f) f,
PDL_LIST_FLAGS_PARAMS(X) PDL_LIST_FLAGS_PARAMS(X)
#undef X #undef X
0 0
}; };
char *paramflagchar[] = { char *paramflagchar[] = {
skipping to change at line 156 skipping to change at line 156
PDL_TYPELIST_ALL(X) PDL_TYPELIST_ALL(X)
#undef X #undef X
-1 -1
}; };
char *typechar[] = { char *typechar[] = {
#define X(sym, ...) #sym, #define X(sym, ...) #sym,
PDL_TYPELIST_ALL(X) PDL_TYPELIST_ALL(X)
#undef X #undef X
NULL NULL
}; };
printf("DUMPTHREAD %p\n",(void*)thread); printf("DUMPBROADCAST %p\n",(void*)broadcast);
if (thread->transvtable) { if (broadcast->transvtable) {
pdl_transvtable *vtable = thread->transvtable; pdl_transvtable *vtable = broadcast->transvtable;
psp; printf("Funcname: %s\n",vtable->name); psp; printf("Funcname: %s\n",vtable->name);
psp; printf("Types: "); psp; printf("Types: ");
found=0; sz=0; found=0; sz=0;
for (i=0;vtable->gentypes[i]!=-1; i++) { for (i=0;vtable->gentypes[i]!=-1; i++) {
if (sz>PDL_MAXLIN) {sz=0; printf("\n");psp;psp;} if (sz>PDL_MAXLIN) {sz=0; printf("\n");psp;psp;}
printf("%s%s",found ? ",":"",typechar[vtable->gentypes[i]]); printf("%s%s",found ? ",":"",typechar[vtable->gentypes[i]]);
found = 1; found = 1;
sz += strlen(typechar[vtable->gentypes[i]]); sz += strlen(typechar[vtable->gentypes[i]]);
} }
printf("\n"); printf("\n");
skipping to change at line 202 skipping to change at line 202
printf("%s",paramflagchar[j]); printf("%s",paramflagchar[j]);
sz += strlen(paramflagchar[j]); sz += strlen(paramflagchar[j]);
} }
if (!found) printf("(no flags set)"); if (!found) printf("(no flags set)");
printf("\n"); printf("\n");
} }
psp; printf("Indices: "); psp; printf("Indices: ");
for (i=0;i<vtable->ninds;i++) for (i=0;i<vtable->ninds;i++)
printf("%s ",vtable->ind_names[i]); printf("%s ",vtable->ind_names[i]);
printf("\n"); printf("\n");
psp; printf("Realdims: "); pdl_print_iarr(vtable->par_realdims,thread->npdls ); printf("\n"); psp; printf("Realdims: "); pdl_print_iarr(vtable->par_realdims,broadcast->np dls); printf("\n");
} }
psp; printf("Flags: "); psp; printf("Flags: ");
found=0; sz=0; found=0; sz=0;
for (i=0;flagval[i]!=0; i++) for (i=0;flagval[i]!=0; i++)
if (thread->gflags & flagval[i]) { if (broadcast->gflags & flagval[i]) {
if (sz>PDL_MAXLIN) {sz=0; printf("\n");psp;} if (sz>PDL_MAXLIN) {sz=0; printf("\n");psp;}
printf("%s%s",found ? "|":"",flagchar[i]); printf("%s%s",found ? "|":"",flagchar[i]);
found = 1; found = 1;
sz += strlen(flagchar[i]); sz += strlen(flagchar[i]);
} }
printf("\n"); printf("\n");
psp; printf("Ndims: %"IND_FLAG", Nimplicit: %"IND_FLAG", Npdls: %"IND_FLAG", N extra: %"IND_FLAG"\n", psp; printf("Ndims: %"IND_FLAG", Nimplicit: %"IND_FLAG", Npdls: %"IND_FLAG", N extra: %"IND_FLAG"\n",
thread->ndims,thread->nimpl,thread->npdls,thread->nextra); broadcast->ndims,broadcast->nimpl,broadcast->npdls,broadcast->nextra);
psp; printf("Mag_nth: %"IND_FLAG", Mag_nthpdl: %"IND_FLAG", Mag_nthr: %"IND_FL AG", Mag_skip: %"IND_FLAG", Mag_stride: %"IND_FLAG"\n", psp; printf("Mag_nth: %"IND_FLAG", Mag_nthpdl: %"IND_FLAG", Mag_nthr: %"IND_FL AG", Mag_skip: %"IND_FLAG", Mag_stride: %"IND_FLAG"\n",
thread->mag_nth,thread->mag_nthpdl,thread->mag_nthr,thread->mag_skip,thr broadcast->mag_nth,broadcast->mag_nthpdl,broadcast->mag_nthr,broadcast->
ead->mag_stride); mag_skip,broadcast->mag_stride);
if (thread->mag_nthr <= 0) { if (broadcast->mag_nthr <= 0) {
psp; printf("Dims: "); pdl_print_iarr(thread->dims,thread->ndims); printf("\ psp; printf("Dims: "); pdl_print_iarr(broadcast->dims,broadcast->ndims); pri
n"); ntf("\n");
psp; printf("Inds: "); pdl_print_iarr(thread->inds,thread->ndims); printf("\ psp; printf("Inds: "); pdl_print_iarr(broadcast->inds,broadcast->ndims); pri
n"); ntf("\n");
psp; printf("Offs: "); pdl_print_iarr(thread->offs,thread->npdls); printf("\ psp; printf("Offs: "); pdl_print_iarr(broadcast->offs,broadcast->npdls); pri
n"); ntf("\n");
} else { } else {
psp; printf("Dims (per thread):\n"); psp; printf("Dims (per thread):\n");
for (i=0;i<thread->mag_nthr;i++) { for (i=0;i<broadcast->mag_nthr;i++) {
psp; psp; pdl_print_iarr(thread->dims + i*thread->ndims,thread->ndims); psp; psp; pdl_print_iarr(broadcast->dims + i*broadcast->ndims,broadcast->n
dims);
printf("\n"); printf("\n");
} }
psp; printf("Inds (per thread):\n"); psp; printf("Inds (per thread):\n");
for (i=0;i<thread->mag_nthr;i++) { for (i=0;i<broadcast->mag_nthr;i++) {
psp; psp; pdl_print_iarr(thread->inds + i*thread->ndims,thread->ndims); psp; psp; pdl_print_iarr(broadcast->inds + i*broadcast->ndims,broadcast->n
dims);
printf("\n"); printf("\n");
} }
psp; printf("Offs (per thread):\n"); psp; printf("Offs (per thread):\n");
for (i=0;i<thread->mag_nthr;i++) { for (i=0;i<broadcast->mag_nthr;i++) {
psp; psp; pdl_print_iarr(thread->offs + i*thread->npdls,thread->npdls); psp; psp; pdl_print_iarr(broadcast->offs + i*broadcast->npdls,broadcast->n
pdls);
printf("\n"); printf("\n");
} }
} }
psp; printf("Incs (per dim):\n"); psp; printf("Incs (per dim):\n");
for (i=0;i<thread->ndims;i++) { for (i=0;i<broadcast->ndims;i++) {
psp; psp; pdl_print_iarr(&PDL_THR_INC(thread->incs, thread->npdls, 0, i),thr psp; psp; pdl_print_iarr(&PDL_BRC_INC(broadcast->incs, broadcast->npdls, 0,
ead->npdls); i),broadcast->npdls);
printf("\n"); printf("\n");
} }
psp; printf("Realdims: "); pdl_print_iarr(thread->realdims,thread->npdls); pri ntf("\n"); psp; printf("Realdims: "); pdl_print_iarr(broadcast->realdims,broadcast->npdls ); printf("\n");
psp; printf("Pdls: ("); psp; printf("Pdls: (");
for (i=0;i<thread->npdls;i++) for (i=0;i<broadcast->npdls;i++)
printf("%s%p",(i?" ":""),(void*)(thread->pdls[i])); printf("%s%p",(i?" ":""),(void*)(broadcast->pdls[i]));
printf(")\n"); printf(")\n");
psp; printf("Per pdl flags: ("); psp; printf("Per pdl flags: (");
for (i=0;i<thread->npdls;i++) for (i=0;i<broadcast->npdls;i++)
printf("%s%d",(i?" ":""),thread->flags[i]); printf("%s%d",(i?" ":""),broadcast->flags[i]);
printf(")\n"); printf(")\n");
} }
void pdl_dump_threading_info( void pdl_dump_broadcasting_info(
int npdls, PDL_Indx* creating, int target_pthread, int npdls, PDL_Indx* creating, int target_pthread,
PDL_Indx *nthreadedDims, PDL_Indx **threadedDims, PDL_Indx **threadedDimSizes, PDL_Indx *nbroadcastedDims, PDL_Indx **broadcastedDims, PDL_Indx **broadcasted DimSizes,
int maxPthreadPDL, int maxPthreadDim, int maxPthread int maxPthreadPDL, int maxPthreadDim, int maxPthread
) { ) {
PDL_Indx j, k; PDL_Indx j, k;
for(j=0; j<npdls; j++) { for(j=0; j<npdls; j++) {
if(creating[j]) continue; if(creating[j]) continue;
printf("PDL %"IND_FLAG":\n", j); printf("PDL %"IND_FLAG":\n", j);
for( k=0; k < nthreadedDims[j]; k++){ for( k=0; k < nbroadcastedDims[j]; k++){
printf("Thread dim %"IND_FLAG", Dim No %"IND_FLAG", Size %"IND_FLAG"\n", printf("Broadcast dim %"IND_FLAG", Dim No %"IND_FLAG", Size %"IND_FLAG"\n"
k, threadedDims[j][k], threadedDimSizes[j][k]); ,
k, broadcastedDims[j][k], broadcastedDimSizes[j][k]);
} }
} }
printf("\nTarget Pthread = %d\n" printf("\nTarget Pthread = %d\n"
"maxPthread = %d, maxPthreadPDL = %d, maxPthreadDim = %d\n", "maxPthread = %d, maxPthreadPDL = %d, maxPthreadDim = %d\n",
target_pthread, maxPthread, maxPthreadPDL, maxPthreadDim); target_pthread, maxPthread, maxPthreadPDL, maxPthreadDim);
} }
void pdl_thread_mismatch_msg( void pdl_broadcast_mismatch_msg(
char *s, char *s,
pdl **pdls, pdl_thread *thread, pdl **pdls, pdl_broadcast *broadcast,
PDL_Indx i, PDL_Indx j, PDL_Indx nimpl, PDL_Indx i, PDL_Indx j, PDL_Indx nimpl,
PDL_Indx *realdims,PDL_Indx *creating PDL_Indx *realdims,PDL_Indx *creating
) { ) {
/* This probably uses a lot more lines than necessary */ /* This probably uses a lot more lines than necessary */
int ii,jj,maxrealdims; int ii,jj,maxrealdims;
sprintf(s, sprintf(s,
" Mismatched implicit thread dimension %"IND_FLAG": size %"IND_FLAG" vs. %" " Mismatched implicit broadcast dimension %"IND_FLAG": size %"IND_FLAG" vs.
IND_FLAG"\nThere are %"IND_FLAG" PDLs in the expression; %"IND_FLAG" thread dim% %"IND_FLAG"\nThere are %"IND_FLAG" PDLs in the expression; %"IND_FLAG" broadcas
s.\n", t dim%s.\n",
i,thread->dims[i],pdls[j]->dims[i+realdims[j]], i,broadcast->dims[i],pdls[j]->dims[i+realdims[j]],
thread->npdls,nimpl,(nimpl==1)?"":"s" broadcast->npdls,nimpl,(nimpl==1)?"":"s"
); );
s += strlen(s); s += strlen(s);
for(ii=maxrealdims=0; ii<thread->npdls; ii++) for(ii=maxrealdims=0; ii<broadcast->npdls; ii++)
if(thread->realdims[ii]>maxrealdims) if(broadcast->realdims[ii]>maxrealdims)
maxrealdims=thread->realdims[ii]; maxrealdims=broadcast->realdims[ii];
sprintf(s, " PDL IN EXPR. "); s += strlen(s); sprintf(s, " PDL IN EXPR. "); s += strlen(s);
if(maxrealdims > 0) { if(maxrealdims > 0) {
char format[80]; char format[80];
sprintf(format,"%%%ds",8 * maxrealdims + 3); sprintf(format,"%%%ds",8 * maxrealdims + 3);
sprintf(s,format,"ACTIVE DIMS | "); sprintf(s,format,"ACTIVE DIMS | ");
s += strlen(s); s += strlen(s);
} }
sprintf(s,"THREAD DIMS\n"); sprintf(s,"BROADCAST DIMS\n");
s += strlen(s); s += strlen(s);
for(ii=0; ii<thread->npdls; ii++) { for(ii=0; ii<broadcast->npdls; ii++) {
sprintf(s," #%3d (%s",ii,creating[ii]?"null)\n":"normal): "); sprintf(s," #%3d (%s",ii,creating[ii]?"null)\n":"normal): ");
s += strlen(s); s += strlen(s);
if(creating[ii]) if(creating[ii])
continue; continue;
if(maxrealdims == 1) { if(maxrealdims == 1) {
sprintf(s," "); sprintf(s," ");
s += strlen(s); s += strlen(s);
} }
for(jj=0; jj< maxrealdims - thread->realdims[ii]; jj++) { for(jj=0; jj< maxrealdims - broadcast->realdims[ii]; jj++) {
sprintf(s,"%8s"," "); sprintf(s,"%8s"," ");
s += strlen(s); s += strlen(s);
} }
for(jj=0; jj< thread->realdims[ii]; jj++) { for(jj=0; jj< broadcast->realdims[ii]; jj++) {
sprintf(s,"%8"IND_FLAG,pdls[ii]->dims[jj]); sprintf(s,"%8"IND_FLAG,pdls[ii]->dims[jj]);
s += strlen(s); s += strlen(s);
} }
if(maxrealdims) { if(maxrealdims) {
sprintf(s," | "); sprintf(s," | ");
s += strlen(s); s += strlen(s);
} }
for(jj=0; jj<nimpl && jj + thread->realdims[ii] < pdls[ii]->ndims; jj++) { for(jj=0; jj<nimpl && jj + broadcast->realdims[ii] < pdls[ii]->ndims; jj++)
sprintf(s,"%8"IND_FLAG,pdls[ii]->dims[jj+thread->realdims[ii]]); {
sprintf(s,"%8"IND_FLAG,pdls[ii]->dims[jj+broadcast->realdims[ii]]);
s += strlen(s); s += strlen(s);
} }
sprintf(s,"\n"); sprintf(s,"\n");
s += strlen(s); s += strlen(s);
} }
} }
void pdl_dump_flags_fixspace(int flags, int nspac, pdl_flags type) void pdl_dump_flags_fixspace(int flags, int nspac, pdl_flags type)
{ {
int i; int i;
skipping to change at line 454 skipping to change at line 454
printf("%s datasv: %p, Svlen: %d, refcnt: %d\n", spaces, printf("%s datasv: %p, Svlen: %d, refcnt: %d\n", spaces,
(void*)it->datasv, (int)SvCUR((SV*)it->datasv), (int)SvRE FCNT((SV*)it->datasv)); (void*)it->datasv, (int)SvCUR((SV*)it->datasv), (int)SvRE FCNT((SV*)it->datasv));
if(it->data) if(it->data)
printf("%s data: %p, nbytes: %"IND_FLAG", nvals: %"IND_FLAG"\n" , spaces, printf("%s data: %p, nbytes: %"IND_FLAG", nvals: %"IND_FLAG"\n" , spaces,
(void*)(it->data), it->nbytes, it->nvals); (void*)(it->data), it->nbytes, it->nvals);
if(it->hdrsv) if(it->hdrsv)
printf("%s hdrsv: %p, reftype %s\n", spaces, printf("%s hdrsv: %p, reftype %s\n", spaces,
(void*)it->hdrsv, sv_reftype((SV*)it->hdrsv, TRUE)); (void*)it->hdrsv, sv_reftype((SV*)it->hdrsv, TRUE));
printf("%s Dims: %p ",spaces,(void*)it->dims); printf("%s Dims: %p ",spaces,(void*)it->dims);
pdl_print_iarr(it->dims, it->ndims); pdl_print_iarr(it->dims, it->ndims);
printf("\n%s ThreadIds: %p ",spaces,(void*)(it->threadids)); printf("\n%s BroadcastIds: %p ",spaces,(void*)(it->broadcastids));
pdl_print_iarr(it->threadids, it->nthreadids); pdl_print_iarr(it->broadcastids, it->nbroadcastids);
if(PDL_VAFFOK(it)) { if(PDL_VAFFOK(it)) {
printf("\n%s Vaffine ok: %p (parent), o:%"IND_FLAG", i:", printf("\n%s Vaffine ok: %p (parent), o:%"IND_FLAG", i:",
spaces,(void*)(it->vafftrans->from),it->vafftrans->offs); spaces,(void*)(it->vafftrans->from),it->vafftrans->offs);
pdl_print_iarr(PDL_REPRINCS(it), it->vafftrans->ndims); pdl_print_iarr(PDL_REPRINCS(it), it->vafftrans->ndims);
} }
if(it->state & PDL_ALLOCATED) { if(it->state & PDL_ALLOCATED) {
printf("\n%s First values: (",spaces); printf("\n%s First values: (",spaces);
for(i=0; i<it->nvals && i<10; i++) { for(i=0; i<it->nvals && i<10; i++) {
if (i) printf(" "); if (i) printf(" ");
pdl_dump_anyval(pdl_get_offs(it,i)); pdl_dump_anyval(pdl_get_offs(it,i));
 End of changes. 28 change blocks. 
55 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)