Changeset 107

Show
Ignore:
Timestamp:
03/19/07 01:01:25
Author:
apokayi
Message:

some modifications for fread_shared to include GULA_FAIL
added verification for async read

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/io_fread_shared_async_ind.upc

    r103 r107  
    1414#endif 
    1515 
    16  
    1716/* nmembs and offsets, this only works for up to 8 threads */ 
    1817static int nmembs [] = { 23, 37, 12 , 44, 14, 31, 4, 55}; 
    19 static int offsets [] = { 2, 30, 81 , 25, 77, 121, 139, 47}; 
     18static int offsets [] = { 2, 30, 81 , 25, 12, 21, 39, 47}; 
    2019 
    2120int 
     
    4140        upc_barrier; 
    4241 
    43         upc_all_fseek(fd, offsets[MYTHREAD]*sizeof(int), UPC_SEEK_SET); 
     42        upc_all_fseek(fd, offsets[MYTHREAD]*sizeof(TYPE), UPC_SEEK_SET); 
    4443         
    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); 
    4645        ssize_t bytes = upc_all_fwait_async(fd); 
    47         fprintf(stderr, "finish reading Th%d ret = %d\n", MYTHREAD, bytes); 
     46         
    4847        upc_barrier; 
    4948 
    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        } 
    5954 
    6055        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"); 
    6258         
    6359#if BLOCKSIZE != 0        
  • src/io_fread_shared_ind.upc

    r98 r107  
    3939        upc_file_t* fd = upc_all_fopen(argv[1], UPC_RDONLY | UPC_INDIVIDUAL_FP, 0, NULL); 
    4040        if (fd == NULL) { 
    41                 printf("fail to open file: %s\n", argv[1]); 
    4241#if BLOCKSIZE != 0 
    43                if (MYTHREAD == 0) 
    44                        upc_free(buffer); 
     42                if (MYTHREAD == 0) 
     43                        upc_free(buffer); 
    4544#endif 
    46  
    47                 return -1; 
    48         } 
     45                GULA_FAIL("failed to open the file using UPC_RDONLY | UPC_INDIVIDUAL_FP"); 
     46        } 
    4947        upc_barrier; 
    5048