Skip to content

Commit efa9d2f

Browse files
committed
fix: address code review feedback
- Fix 4 critical kernel bugs: use 3D blockId with uint64_t in simulator_cuda_kernels.h - Create shared utilities in lib/util_cuda.h (GetBlockId, CreateGrid) - Remove code duplication: eliminate duplicate CreateGrid functions - Fix type safety in apps/qsimh_base_cuda.cu (std::stoul/std::stoull) - Update all files to use shared 3D grid utilities All changes verified with 32-qubit simulation test.
1 parent 23e10c2 commit efa9d2f

9 files changed

Lines changed: 754 additions & 51 deletions

apps/qsimh_base_cuda.cu

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Options GetOptions(int argc, char* argv[]) {
5757
int k;
5858

5959
auto to_int = [](const std::string& word) -> unsigned {
60-
return std::atoi(word.c_str());
60+
return std::stoul(word);
6161
};
6262

6363
while ((k = getopt(argc, argv, "c:d:k:w:p:r:t:n:v:z")) != -1) {
@@ -66,28 +66,28 @@ Options GetOptions(int argc, char* argv[]) {
6666
opt.circuit_file = optarg;
6767
break;
6868
case 'd':
69-
opt.maxtime = std::atoi(optarg);
69+
opt.maxtime = std::stoul(optarg);
7070
break;
7171
case 'k':
7272
qsim::SplitString(optarg, ',', to_int, opt.part1);
7373
break;
7474
case 'w':
75-
opt.prefix = std::atol(optarg);
75+
opt.prefix = std::stoull(optarg);
7676
break;
7777
case 'p':
78-
opt.num_prefix_gatexs = std::atoi(optarg);
78+
opt.num_prefix_gatexs = std::stoul(optarg);
7979
break;
8080
case 'r':
81-
opt.num_root_gatexs = std::atoi(optarg);
81+
opt.num_root_gatexs = std::stoul(optarg);
8282
break;
8383
case 't':
84-
opt.num_threads = std::atoi(optarg);
84+
opt.num_threads = std::stoul(optarg);
8585
break;
8686
case 'n':
87-
opt.num_dblocks = std::atoi(optarg);
87+
opt.num_dblocks = std::stoul(optarg);
8888
break;
8989
case 'v':
90-
opt.verbosity = std::atoi(optarg);
90+
opt.verbosity = std::stoul(optarg);
9191
break;
9292
case 'z':
9393
opt.denormals_are_zeros = true;

0 commit comments

Comments
 (0)