Commit 4062d5fc authored by cianciosa's avatar cianciosa
Browse files

Fix warnings and asserts that happen when file names are empty. Also fix rm...

Fix warnings and asserts that happen when file names are empty. Also fix rm warning when compile method of cpu_context is not called.
parent b9228ab2
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -66,10 +66,12 @@ namespace gpu {
        ~cpu_context() {
            dlclose(lib_handle);

            if (!library_name.empty()) {
                std::ostringstream temp_stream;
                temp_stream << "rm " << library_name;
                system(temp_stream.str().c_str());
            }
        }

//------------------------------------------------------------------------------
///  @brief Compile the kernels.
+7 −2
Original line number Diff line number Diff line
@@ -49,13 +49,18 @@ namespace output {
        result_file(const std::string &filename,
                    const size_t num_rays) :
        num_rays(num_rays) {
            const std::string temp = filename.empty() ? jit::format_to_string(reinterpret_cast<size_t> (this)) :
                                                        filename;

            sync.lock();
            check_error(nc_create(filename.c_str(),
            check_error(nc_create(temp.c_str(),
                                  filename.empty() || num_rays == 0 ? NC_DISKLESS : NC_CLOBBER,
                                  &ncid));

            check_error(nc_def_dim(ncid, "time", NC_UNLIMITED, &unlimited_dim));
            check_error(nc_def_dim(ncid, "num_rays", num_rays, &num_rays_dim));
            check_error(nc_def_dim(ncid, "num_rays",
                                   num_rays ? num_rays : 1,
                                   &num_rays_dim));
            sync.unlock();
        }