I am working on a testing tool for nvme-cli(written in c and can run on linux).
I am interested in repeating a nvme command 'r' number of times with 't' number of threads.
The below code does the repeat of each command along with threading, but the issue here is the parallel execution time is very much high compared to serial execution.
The reason I found was
err = nvme_identify(fd, 0, 1, data);
in-turn calls system call ioctl();
#pragma omp parallel for num_threads(5)
for(i=0; i<rc; i++){
err = nvme_identify(fd, 0, 1, data);
if (!err) {
if (rf->fmt == BINARY)
d_raw((unsigned char *)&rf->ctrl, sizeof(rf->ctrl));
else if (rf->fmt == JSON)
json_nvme_id_ctrl(data, flags, 0);
else {
printf("NVME Identify Controller:\n");
__show_nvme_id_ctrl(data, flags, 0);
}
}
else if (err > 0)
fprintf(stderr, "NVMe Status:%s(%x)\n",
nvme_status_to_string(err), err);
else
perror("identify controller");
So can I know how to get true parallelism for this either with openmp or pthreads?