Skip to content

Commit

Permalink
code review fix 1
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel committed Feb 14, 2024
1 parent eb9e859 commit 03e9057
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions icicle/appUtils/ntt/ntt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,18 @@ namespace ntt {
CHK_INIT_IF_RETURN();

if (size > Domain<S>::max_size) {
std::cerr << "[ERROR] NTT size=" << size
<< " is too large for the domain. Consider generating your domain with a higher order root of unity.";
return cudaErrorInvalidValue;
std::ostringstream oss;
oss << "NTT size=" << size
<< " is too large for the domain. Consider generating your domain with a higher order root of unity.\n";
THROW_ICICLE_ERR(IcicleError_t::InvalidArgument, oss.str().c_str());
}

int logn = int(log2(size));
const bool is_size_power_of_two = size == (1 << logn);
if (!is_size_power_of_two) {
std::cerr << "[ERROR] NTT size=" << size << " is not supported since it is not a power of two.";
return cudaErrorInvalidValue;
std::ostringstream oss;
oss << "NTT size=" << size << " is not supported since it is not a power of two.\n";
THROW_ICICLE_ERR(IcicleError_t::InvalidArgument, oss.str().c_str());
}

cudaStream_t& stream = config.ctx.stream;
Expand Down
4 changes: 2 additions & 2 deletions icicle/utils/error_handler.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ void inline throwIcicleCudaErr(
void inline throwIcicleErr(
IcicleError_t err, const char* const reason, const char* const func, const char* const file, const int line)
{
std::string err_msg =
std::string{IcicleGetErrorString(err)} + " : by: " + func + " at: " + file + ":" + std::to_string(line);
std::string err_msg = std::string{IcicleGetErrorString(err)} + " : by: " + func + " at: " + file + ":" +
std::to_string(line) + " error: " + reason;
std::cerr << err_msg << std::endl; // TODO: Logging
throw IcicleError{err, err_msg};
}
Expand Down

0 comments on commit 03e9057

Please sign in to comment.