Changeset 104

Show
Ignore:
Timestamp:
03/18/07 07:48:42
Author:
kunxi
Message:

Add validateon for io_fwrite_shared_comm
Fix the guts to handle memvec

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • guts.sh

    r101 r104  
    8484# check whether the MEMVEC size is enabled or not 
    8585 
    86 `upcio-config -build >a.out`  
    87 `grep "\-DMEMVEC" a.out` 
     86upcio-config -build | grep "DMEMVEC" 
    8887e_memvec=$? 
    8988 
  • src/io_fwrite_shared_comm.upc

    r93 r104  
    77 
    88/* For all BLOCKSIZE == 0, use the static memeory. 
    9 for all other cases, use the dynamic memory allocation 
    10 */ 
     9 * for all other cases, use the dynamic memory allocation 
     10 */ 
    1111 
    1212#if BLOCKSIZE == 0 
    1313shared [0] TYPE buffer [180]; 
    1414#endif 
     15 
     16shared [0] TYPE vfb[180]; 
    1517 
    1618int 
     
    1921        int i,j; 
    2022        int nmemb = 60; 
    21         int offset = 6; 
    2223        int blocksize = BLOCKSIZE; 
     24        int memoff = 6; 
     25        upc_off_t fileoff = 19; 
    2326        ssize_t bytes; 
    24         upc_off_t vo
     27        upc_off_t offset
    2528 
    2629#if BLOCKSIZE != 0 
     
    3134                for( i = 0; i< 180; i++ ) 
    3235                        buffer[i] = i % 256; 
    33  
    34         fprintf(stderr, "start writing Th%d \n", MYTHREAD); 
    3536        upc_barrier; 
    3637 
    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); 
    3839        if (fd == NULL) { 
    3940#if BLOCKSIZE != 0 
     
    4142                        upc_free(buffer); 
    4243#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"); 
    4445        } 
    4546 
    4647        upc_barrier; 
    4748 
    48         upc_all_fseek(fd, 16, UPC_SEEK_SET); 
     49        upc_all_fseek(fd, fileoff * sizeof(TYPE), UPC_SEEK_SET); 
    4950         
    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"); 
    5359        upc_barrier; 
    5460 
     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; 
    5572#if BLOCKSIZE != 0 
    5673        if (MYTHREAD == 0) 
     
    6178} 
    6279 
     80 
  • src/io_fwrite_shared_ind.upc

    r102 r104  
    5151 
    5252        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); 
    5454 
    5555        if (bytes != nmemb * sizeof(TYPE))