for int for int dt st_n round dt _end_n round round round round dt st_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
for (int i = 0; i < p; i++)
{
for (int j = 0; j < p; j++)
{
dt[j].st_n = i * round(n/p);
dt[j]._end_n = (i == (p - 1)) ? (i * round(n/p) + round(n/p) + n % p) : (i * round(n/p) + round(n/p) - 1);
dt[j].st_m = j * round(m/p);
dt[j]._end_m = (j == (p - 1)) ? (j * round(m/p) + round(m/p) + m % p) : (j * round(m/p) + round(m/p));
cout << "dt[i].st_n = " << dt[j].st_n << " dt[i]._end_n = "
<< dt[j]._end_n << " dt[i].st_m = " << dt[j].st_m << " dt[i]._end_m = " << dt[j]._end_m << endl;
pthread_create(&th[j], NULL, rowFunc, &dt[j]);
}
}