Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hallo Olaf, hier der Fix für Stefans Fix mit union, und außerdem baut es jetzt auch für ältere GPUs #3

Merged
merged 10 commits into from
Apr 1, 2011
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ if test x$with_cuda != xno; then
# if no other compute capability is defined by the user, we need at least 1.1
case "$NVCCFLAGS" in
*-arch=*) ;;
*) NVCCFLAGS="$NVCCFLAGS --ptxas-options=-v -arch=compute_20 -code=sm_20"
*) NVCCFLAGS="$NVCCFLAGS --ptxas-options=-v -gencode arch=compute_11,code=compute_11 -gencode arch=compute_20,code=compute_20"
esac
# use nvcc
save_CC=$CC
Expand Down
25 changes: 11 additions & 14 deletions src/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ int tclcallback_ro(Tcl_Interp *interp, void *data)
int tclcommand_setmd(ClientData data, Tcl_Interp *interp,
int argc, char **argv)
{
char databuf[MAX_DIMENSION*(sizeof(int) + sizeof(double))];
union {
int intbuf[MAX_DIMENSION];
double doublebuf[MAX_DIMENSION];
} databuf;
char buffer[TCL_DOUBLE_SPACE + 5];
int i, j;
int all = (argc == 1), writing = (argc >= 3);
Expand Down Expand Up @@ -153,35 +156,29 @@ int tclcommand_setmd(ClientData data, Tcl_Interp *interp,
for (j = 0; j < fields[i].dimension; j++) {
switch (fields[i].type) {
case TYPE_INT:
if (Tcl_GetInt(interp, argv[2 + j], (int *)databuf + j) == TCL_ERROR)
if (Tcl_GetInt(interp, argv[2 + j], databuf.intbuf + j) == TCL_ERROR)
return (TCL_ERROR);
break;
case TYPE_BOOL: {
int dta;
if (Tcl_GetInt(interp, argv[2 + j], &dta))
return (TCL_ERROR);
if (dta) {
int nbyte = j / 8;
int nbit = j % 8;
databuf[nbyte] |= 1 << nbit;
// *(int *)databuf |= (1L << j);
} else {
int nbyte = j / 8;
int nbit = j % 8;
databuf[nbyte] &= ~(1 << nbit);
// *(int *)databuf &= ~(1L << j);
}
databuf.intbuf[0] |= (1L << j);
} else {
databuf.intbuf[0] &= ~(1L << j);
}
break;
}
case TYPE_DOUBLE:
if (Tcl_GetDouble(interp, argv[2 + j], (double *)databuf + j))
if (Tcl_GetDouble(interp, argv[2 + j], databuf.doublebuf + j))
return (TCL_ERROR);
break;
default: ;
}
}

if (fields[i].changeproc(interp, databuf) != TCL_OK)
if (fields[i].changeproc(interp, databuf.intbuf) != TCL_OK)
return mpi_gather_runtime_errors(interp, TCL_ERROR);
/* fall through to write out the set value immediately again */
}
Expand Down