Changeset 107
- Timestamp:
- 03/19/07 01:01:25
- Files:
-
- src/io_fread_shared_async_ind.upc (modified) (2 diffs)
- src/io_fread_shared_ind.upc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/io_fread_shared_async_ind.upc
r103 r107 14 14 #endif 15 15 16 17 16 /* nmembs and offsets, this only works for up to 8 threads */ 18 17 static int nmembs [] = { 23, 37, 12 , 44, 14, 31, 4, 55}; 19 static int offsets [] = { 2, 30, 81 , 25, 77, 121, 139, 47};18 static int offsets [] = { 2, 30, 81 , 25, 12, 21, 39, 47}; 20 19 21 20 int … … 41 40 upc_barrier; 42 41 43 upc_all_fseek(fd, offsets[MYTHREAD]*sizeof( int), UPC_SEEK_SET);42 upc_all_fseek(fd, offsets[MYTHREAD]*sizeof(TYPE), UPC_SEEK_SET); 44 43 45 upc_all_fread_shared_async(fd, buffer+offset, blocksize, sizeof( int), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC);44 upc_all_fread_shared_async(fd, buffer+offset, blocksize, sizeof(TYPE), nmemb, UPC_IN_NOSYNC | UPC_OUT_NOSYNC); 46 45 ssize_t bytes = upc_all_fwait_async(fd); 47 fprintf(stderr, "finish reading Th%d ret = %d\n", MYTHREAD, bytes);46 48 47 upc_barrier; 49 48 50 for( j = 0; j< THREADS; j++ ) { 51 if( MYTHREAD == j) { 52 fprintf(stderr, "TH%d : ", j); 53 for(i = 0; i < nmemb; i++ ) 54 fprintf( stderr, "%u ", buffer[i+offset] ); 55 fprintf(stderr, "\n"); 56 } 57 upc_barrier; 58 } 49 /* Validation for data integrity */ 50 for (i = 0; i < nmemb; i++) { 51 if (buffer[offset + i] != (offsets[MYTHREAD] + i) % 0x80) 52 GULA_FAIL("Data integrity is violated!"); 53 } 59 54 60 55 offset = upc_all_fseek(fd, 0, UPC_SEEK_CUR); 61 fprintf(stderr, "TH%d: origin = %d, read %d bytes, cur =%d \n", MYTHREAD, offsets[MYTHREAD], bytes, offset); 56 if (offset != (offsets[MYTHREAD] + nmemb) * sizeof(TYPE)) 57 GULA_FAIL("Fail to setup the file pointer"); 62 58 63 59 #if BLOCKSIZE != 0 src/io_fread_shared_ind.upc
r98 r107 39 39 upc_file_t* fd = upc_all_fopen(argv[1], UPC_RDONLY | UPC_INDIVIDUAL_FP, 0, NULL); 40 40 if (fd == NULL) { 41 printf("fail to open file: %s\n", argv[1]);42 41 #if BLOCKSIZE != 0 43 if (MYTHREAD == 0)44 upc_free(buffer);42 if (MYTHREAD == 0) 43 upc_free(buffer); 45 44 #endif 46 47 return -1; 48 } 45 GULA_FAIL("failed to open the file using UPC_RDONLY | UPC_INDIVIDUAL_FP"); 46 } 49 47 upc_barrier; 50 48
