Changeset 104
- Timestamp:
- 03/18/07 07:48:42
- Files:
-
- guts.sh (modified) (1 diff)
- src/io_fwrite_shared_comm.upc (modified) (5 diffs)
- src/io_fwrite_shared_ind.upc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
guts.sh
r101 r104 84 84 # check whether the MEMVEC size is enabled or not 85 85 86 `upcio-config -build >a.out` 87 `grep "\-DMEMVEC" a.out` 86 upcio-config -build | grep "DMEMVEC" 88 87 e_memvec=$? 89 88 src/io_fwrite_shared_comm.upc
r93 r104 7 7 8 8 /* For all BLOCKSIZE == 0, use the static memeory. 9 for all other cases, use the dynamic memory allocation10 */9 * for all other cases, use the dynamic memory allocation 10 */ 11 11 12 12 #if BLOCKSIZE == 0 13 13 shared [0] TYPE buffer [180]; 14 14 #endif 15 16 shared [0] TYPE vfb[180]; 15 17 16 18 int … … 19 21 int i,j; 20 22 int nmemb = 60; 21 int offset = 6;22 23 int blocksize = BLOCKSIZE; 24 int memoff = 6; 25 upc_off_t fileoff = 19; 23 26 ssize_t bytes; 24 upc_off_t vo;27 upc_off_t offset; 25 28 26 29 #if BLOCKSIZE != 0 … … 31 34 for( i = 0; i< 180; i++ ) 32 35 buffer[i] = i % 256; 33 34 fprintf(stderr, "start writing Th%d \n", MYTHREAD);35 36 upc_barrier; 36 37 37 upc_file_t* fd = upc_all_fopen("write_test.txt", UPC_WRONLY| UPC_COMMON_FP, 0, NULL);38 upc_file_t* fd = upc_all_fopen("write_test.txt", UPC_RDWR | UPC_CREATE | UPC_TRUNC | UPC_COMMON_FP, 0, NULL); 38 39 if (fd == NULL) { 39 40 #if BLOCKSIZE != 0 … … 41 42 upc_free(buffer); 42 43 #endif 43 GULA_FAIL("failed to open the file using UPC_ WRONLY| UPC_COMMON_FP");44 GULA_FAIL("failed to open the file using UPC_RDWR | UPC_COMMON_FP"); 44 45 } 45 46 46 47 upc_barrier; 47 48 48 upc_all_fseek(fd, 16, UPC_SEEK_SET);49 upc_all_fseek(fd, fileoff * sizeof(TYPE), UPC_SEEK_SET); 49 50 50 bytes = upc_all_fwrite_shared(fd, buffer+offset, blocksize, sizeof(int), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); 51 vo = upc_all_fseek(fd, 0, UPC_SEEK_CUR); 52 fprintf(stderr, "Th%d: origin=%d, write %d bytes, cur=%d\n", MYTHREAD, 16*sizeof(TYPE), bytes, vo); 51 bytes = upc_all_fwrite_shared(fd, buffer + memoff, blocksize, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); 52 53 if (bytes != nmemb * sizeof(TYPE)) 54 GULA_FAIL("Short write is not expected, is disc full ?"); 55 56 offset = upc_all_fseek(fd, 0, UPC_SEEK_CUR); 57 if (offset != (fileoff + nmemb) * sizeof(TYPE)) 58 GULA_FAIL("Fail to setup the file pointer"); 53 59 upc_barrier; 54 60 61 /* Validation for data integrity */ 62 upc_all_fsync(fd); 63 upc_all_fseek(fd, fileoff * sizeof(TYPE), UPC_SEEK_SET); 64 upc_all_fread_shared(fd, vfb, 0, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); 65 66 for (i = 0; i < nmemb; i++) { 67 if (vfb[i] != (memoff + i) % 0x80) 68 GULA_FAIL("Data integrity is violated!"); 69 } 70 71 upc_barrier; 55 72 #if BLOCKSIZE != 0 56 73 if (MYTHREAD == 0) … … 61 78 } 62 79 80 src/io_fwrite_shared_ind.upc
r102 r104 51 51 52 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);53 bytes = upc_all_fwrite_shared(fd, buffer + offset, blocksize, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); 54 54 55 55 if (bytes != nmemb * sizeof(TYPE))
