예제 #1
0
파일: osbdev.c 프로젝트: peterliu2/FreeRTOS
/** @brief Write sectors to a disk.

    @param bVolNum          The volume number of the volume whose block device
                            is being written to.
    @param ullSectorStart   The starting sector number.
    @param ulSectorCount    The number of sectors to write.
    @param pBuffer          The buffer from which to write the sector data.

    @return A negated ::REDSTATUS code indicating the operation result.

    @retval 0           Operation was successful.
    @retval -RED_EINVAL The block device is not open.
    @retval -RED_EIO    A disk I/O error occurred.
*/
static REDSTATUS DiskWrite(
    uint8_t     bVolNum,
    uint64_t    ullSectorStart,
    uint32_t    ulSectorCount,
    const void *pBuffer)
{
    REDSTATUS   ret = 0;
    F_DRIVER   *pDriver = gapFDriver[bVolNum];

    if(pDriver == NULL) {
        ret = -RED_EINVAL;
    } else {
        const uint8_t  *pbBuffer = CAST_VOID_PTR_TO_CONST_UINT8_PTR(pBuffer);
        uint32_t        ulSectorSize = gaRedVolConf[bVolNum].ulSectorSize;
        uint32_t        ulSectorIdx;
        int             iErr;

        for(ulSectorIdx = 0U; ulSectorIdx < ulSectorCount; ulSectorIdx++) {
            /*  We have to cast pbBuffer to non-const since the writesector
                prototype is flawed, using a non-const pointer for the buffer.
            */
            iErr = pDriver->writesector(pDriver, CAST_AWAY_CONST(uint8_t, &pbBuffer[ulSectorIdx * ulSectorSize]),
                                        CAST_ULONG(ullSectorStart + ulSectorCount));
            if(iErr != 0) {
                ret = -RED_EIO;
                break;
            }
        }
    }

    return ret;
}
예제 #2
0
파일: main.C 프로젝트: DeanHowarth/QUDA-CPS
USING_NAMESPACE_CPS

int main(int argc,char *argv[])
{
 
  //----------------------------------------------------------------
  // Initializes all Global Job Parameters
  //----------------------------------------------------------------
  DoArg do_arg;

#ifdef PARALLEL
// For the 100 Gflop:
  do_arg.x_node_sites = 2;
       do_arg.x_nodes = 2;
  do_arg.y_node_sites = 2;
       do_arg.y_nodes = 2;
  do_arg.z_node_sites = 2;
       do_arg.z_nodes = 2;
  do_arg.t_node_sites = 2;
       do_arg.t_nodes = 2;
  do_arg.s_node_sites = 4;
       do_arg.s_nodes = 1;


#else
  do_arg.x_node_sites = 4;
  do_arg.y_node_sites = 4;
  do_arg.z_node_sites = 4;
  do_arg.t_node_sites = 4;
  do_arg.s_node_sites = 4;
  do_arg.x_nodes = 1;
  do_arg.y_nodes = 1;
  do_arg.z_nodes = 1;
  do_arg.t_nodes = 1;
  do_arg.s_nodes = 1;
#endif

  //----------------------------------------------------------------
  //  Get seed and lattice location
  //----------------------------------------------------------------

  do_arg.start_seed_kind = START_SEED_FIXED;

  do_arg.start_conf_kind = START_CONF_DISORD;

  do_arg.beta = 6.0;
  do_arg.dwf_height = 1.8;


  //----------------------------------------------------------------
  // Initialize the GJP class
  //----------------------------------------------------------------
  GJP.Initialize(do_arg);


  //----------------------------------------------------------------
  // Initialize argument structures
  //----------------------------------------------------------------
  CommonArg common_arg;
  CommonArg common_arg_ghb;
  CommonArg common_arg_plaq;
  ThreePtArg threept_arg;

  NoArg plaq_arg;

  //----------------------------------------------------------------
  // Run Wilson type spectrum                               
  //----------------------------------------------------------------

  threept_arg.cg.stop_rsd = 1.0E-6;
  threept_arg.cg.max_num_iter = 4;
  threept_arg.seed = 16;
	// obsolete
  threept_arg.t_src = 2;
  threept_arg.t_Op = 3;
  threept_arg.t_Op_2 = 5;
  threept_arg.t_sink = 6;
  threept_arg.num_masses = 1;
  threept_arg.mass[0] = .50;
	// strange quark
  threept_arg.mass[1] = .40;
  threept_arg.mass[2] = .030;
  threept_arg.mass[3] = .040;
  threept_arg.mass[4] = .050;
  threept_arg.mass[5] = .075;
  threept_arg.mass[6] = .100;
  threept_arg.mass[7] = .125;

  FixGaugeArg fix_arg;
  fix_arg.fix_gauge_kind=FIX_GAUGE_COULOMB_T;
  fix_arg.hyperplane_start=0;
  fix_arg.hyperplane_step=1;
  fix_arg.hyperplane_num=GJP.Tnodes()*GJP.TnodeSites();
  fix_arg.stop_cond=1e-3;
  fix_arg.max_iter_num=10;
  
  {

    GwilsonFdwf lat;

    common_arg.results = CAST_AWAY_CONST("threept.dat");
    FILE *fp;
    if( (fp = Fopen((char *)(common_arg.results), "a")) == NULL ) {
      ERR.FileA("main", "main", (char *)(common_arg.results) );
    }
    //    Fprintf(fp, "seed= %d\n",do_arg.start_seed_value);
    Fprintf(fp, "do_arg.dwf_height= %e\n", do_arg.dwf_height);
    Fprintf(fp, "prop stop_rsd= %e\n",threept_arg.cg.stop_rsd);
    Fprintf(fp, "gauge fix type= %d\n",fix_arg.fix_gauge_kind);
    Fprintf(fp, "gauge fix stop_cond= %e\n",fix_arg.stop_cond);
    Fprintf(fp, "t_src= %d\n",threept_arg.t_src);
    Fprintf(fp, "t_sink= %d\n",threept_arg.t_sink);
    Fprintf(fp, "t_Op= %d\n",threept_arg.t_Op);
    Fclose(fp);

    AlgPlaq plaq(lat,&common_arg,&plaq_arg);
    plaq.run();

    if(fix_arg.fix_gauge_kind==FIX_GAUGE_COULOMB_T ||
       fix_arg.fix_gauge_kind==FIX_GAUGE_LANDAU){
         AlgFixGauge fix_gauge(lat,&common_arg,&fix_arg);
         fix_gauge.run();
    }


    AlgThreePt threept(lat,&common_arg,&threept_arg);
    threept.run();


  }

  return(0);
}