Skip to content

Add all the missing error messages and stop filtering in pygpu.#449

Merged
abergeron merged 10 commits intoTheano:masterfrom
abergeron:more_error
Jun 7, 2017
Merged

Add all the missing error messages and stop filtering in pygpu.#449
abergeron merged 10 commits intoTheano:masterfrom
abergeron:more_error

Conversation

@abergeron
Copy link
Copy Markdown
Member

I hope I did not miss a spot.

Comment thread src/gpuarray_array.c
if (k == NULL)
return error_set(ctx->err, GA_MISC_ERROR,
"Could not instantiate GpuElemwise copy kernel");
return ctx->err->code;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GpuElemwise_new do not always set the error message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it does.

Comment thread src/gpuarray_array.c Outdated

if (!GpuArray_ISWRITEABLE(a))
return GA_VALUE_ERROR;
return error_set(ctx->err, GA_INVALID_ERROR, "Destination array not writable");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the error type? I think the old one is better.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed back

Comment thread src/gpuarray_array.c Outdated
}

if (newsize != oldsize) return GA_INVALID_ERROR;
if (newsize != oldsize) return error_set(ctx->err, GA_INVALID_ERROR, "New shope differs in total size");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shope -> shape

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread src/gpuarray_array.c Outdated
free(buf);
fprintf(fd, "<unsupported data type %d>\n", a->typecode);
return GA_UNSUPPORTED_ERROR;
return error_set(ctx->err, GA_UNSUPPORTED_ERROR, "Unsupported data type for dump");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can remove the fprintf above and put the typecode inside the error, it would be better.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a debugging help, I want it to be chatty when the data type is not supported.

I've added the typecode to the error message.

Comment thread src/gpuarray_array_blas.c Outdated
if (A->typecode != GA_HALF && A->typecode != GA_FLOAT &&
A->typecode != GA_DOUBLE)
return GA_INVALID_ERROR;
return error_set(ctx->err, GA_INVALID_ERROR, "Unsupported type");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that you use the work "type" for the dtype/typecode. Why you don't use dtype?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed them to dtype.

Comment thread src/gpuarray_array_blas.c Outdated
}
} else {
err = GA_VALUE_ERROR;
err = error_set(ctx->err, GA_VALUE_ERROR, "Invalid internal result for B");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/gpuarray_array_collectives.c Outdated
return error_set(ctx->err, GA_VALUE_ERROR, "Type mismatch");
if (!GpuArray_ISALIGNED(src) || !GpuArray_CHKFLAGS(dest, GA_BEHAVED))
return GA_UNALIGNED_ERROR;
return error_set(ctx->err, GA_UNALIGNED_ERROR, "Misbehaved arrays");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unaligned or misbehaved.
I don't remember what is misbehaved myself, so we can't expect user to also remember. I think you should split that into 2 different error and give a better error for the misbehaved version.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BEHAVED == ALIGNED && WRITABLE

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixed.

Comment thread src/gpuarray_elemwise.c Outdated
ktypes = calloc(p, sizeof(int));
if (ktypes == NULL)
if (ktypes == NULL) {
res = error_fmt(ctx->err, "calloc");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error_sys?

Comment thread src/gpuarray_elemwise.c Outdated
for (j = 0; j < a->nd; j++) {
if (v->dimensions[j] != a->dimensions[j])
return GA_VALUE_ERROR;
return error_fmt(ctx->err, GA_VALUE_ERROR, "Mismatched dimension %u", j);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the values of that dimensions? It really help debug.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/gpuarray_buffer.c
return error_sys(ctx->err, "malloc");
if (tmp == NULL) {
error_sys(src_ctx->err, "malloc");
return error_sys(dst_ctx->err, "malloc");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are the same context, I suppose it is fine to set the error twice. The slow down is probably not important.

@abergeron abergeron merged commit 1137c81 into Theano:master Jun 7, 2017
Comment thread pygpu/gpuarray.pyx
array_index(res, a, starts, stops, steps)
except ValueError, e:
raise IndexError, "index out of bounds"
array_index(res, a, starts, stops, steps)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the reason for the newly-failing test in Theano/Theano#6026 (comment)
I'm not sure what is happening, but presumably what used to be an IndexError was catched somewhere, and now it is a Value Error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix it: #452

@abergeron abergeron deleted the more_error branch August 2, 2017 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants