#include "utils.hpp" #include #include #include #include void check_cuda(cudaError_t st, const char* msg) { if (st != cudaSuccess) { std::cerr << "[CUDA ERROR] " << msg << ": " << cudaGetErrorString(st) << "\n"; std::exit(1); } } void write_submission_csv(const std::string& path, const std::vector& ids, const std::vector& probabilities) { std::ofstream ofs(path); if (!ofs.is_open()) { throw std::runtime_error("Cannot open submission file: " + path); } ofs << "id,label\n"; ofs << std::fixed << std::setprecision(8); for (size_t i = 0; i < ids.size(); ++i) { ofs << ids[i] << "," << probabilities[i] << "\n"; } ofs.close(); std::cout << "[INFO] Submission saved to: " << path << " (" << ids.size() << " rows)\n"; }