| 17 | | /* nmembs and offsets, this only works for up to 8 threads */ |
|---|
| 18 | | static int nmembs [] = { 23, 37, 12 , 20, 55, 3, 11, 40}; |
|---|
| 19 | | static int offsets [] = { 2, 30, 81 , 33, 14, 17, 27, 43}; |
|---|
| | 17 | /* nmembs and offsets, this only works for up to 4 threads */ |
|---|
| | 18 | static int nmembs [] = { 23, 5, 37, 6, 8, 12 }; |
|---|
| | 19 | static int offsets [] = { 2, 120, 30, 102, 110, 81 }; |
|---|
| | 20 | static TYPE vfb[180]; |
|---|
| 53 | | vo = upc_all_fseek(fd, offset, UPC_SEEK_SET); |
|---|
| 54 | | fprintf(stderr, "Th%d: move to %d\n", MYTHREAD, vo); |
|---|
| | 52 | vo = upc_all_fseek(fd, offset * sizeof(TYPE), UPC_SEEK_SET); |
|---|
| | 53 | bytes = upc_all_fwrite_shared(fd, buffer+offset, blocksize, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); |
|---|
| | 54 | |
|---|
| | 55 | if (bytes != nmemb * sizeof(TYPE)) |
|---|
| | 56 | GULA_FAIL("Short write is not expected, is disc full ?"); |
|---|
| | 57 | |
|---|
| | 58 | vo = upc_all_fseek(fd, 0, UPC_SEEK_CUR); |
|---|
| | 59 | if (vo != (offset + nmemb) * sizeof(TYPE)) |
|---|
| | 60 | GULA_FAIL("Fail to setup the file pointer"); |
|---|
| | 62 | |
|---|
| | 63 | /* Validation for data integrity */ |
|---|
| | 64 | upc_all_fsync(fd); |
|---|
| | 65 | vo = upc_all_fseek(fd, offset * sizeof(TYPE), UPC_SEEK_SET); |
|---|
| | 66 | upc_all_fread_local(fd, vfb, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); |
|---|
| | 67 | for (i = 0; i < nmemb; i++) { |
|---|
| | 68 | if (vfb[i] != (offset + i) % 0x80) |
|---|
| | 69 | GULA_FAIL("Data integrity is violated!"); |
|---|
| | 70 | } |
|---|
| 57 | | bytes = upc_all_fwrite_shared(fd, buffer+offset, blocksize, sizeof(char), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); |
|---|
| 58 | | vo = upc_all_fseek(fd, 0, UPC_SEEK_CUR); |
|---|
| 59 | | fprintf(stderr, "th%d: orign=%d, write %d bytes, offset = %d \n", MYTHREAD, offset, bytes, vo); |
|---|