Exemplo n.º 1
0
def ConfigureRunningEnv(num_process, size_tile_cache):
    """Configures the running environment.

  Optimal performance is obtained by increasing the number of process
  and a geo cache big enough to avoid swapping. Each tile covers about
  100kmx100km. Swapping statistics can be obtaines using the routine:
    `CheckTerrainTileCacheOk()`.

  Args:
    num_process: Number of process. Special values: -1: #cpu/2 ; -2: #cpu-1
    size_tile_cache: Geo cache size in number of tiles. The memory usage is
      about: `num_process * size_tile_cache * 60 MB`
  """
    # Configure the global pool of processes
    mpool.Configure(num_process)

    # Configure the geo drivers to avoid swap
    # - for main process
    drive.ConfigureTerrainDriver(cache_size=size_tile_cache)
    drive.ConfigureNlcdDriver(cache_size=size_tile_cache)
    # - for worker processes
    mpool.RunOnEachWorkerProcess(drive.ConfigureTerrainDriver,
                                 terrain_dir=None,
                                 cache_size=size_tile_cache)
    mpool.RunOnEachWorkerProcess(drive.ConfigureNlcdDriver,
                                 nlcd_dir=None,
                                 cache_size=size_tile_cache)
    return mpool.GetNumWorkerProcesses()
Exemplo n.º 2
0
    # Configure geo drivers
    logging.info('Configure geo drivers')
    (num_tiles_master_ned, num_tiles_worker_ned, num_tiles_master_nlcd,
     num_tiles_worker_nlcd) = GetGeoCacheSize(num_workers)
    if num_tiles_master_ned < 16:
        logging.warning('Required geo cache size %d (for master) is low'
                        '- too few memory or too many workers' %
                        num_tiles_master_ned)
    logging.info(' ... NED: cache size: %d per master, %d for workers' %
                 (num_tiles_master_ned, num_tiles_worker_ned))
    logging.info(' ... NLCD: cache size: %d per master, %d for workers' %
                 (num_tiles_master_ned, num_tiles_worker_ned))

    # - for main process
    drive.ConfigureTerrainDriver(cache_size=num_tiles_master_ned)
    drive.ConfigureNlcdDriver(cache_size=num_tiles_master_nlcd)

    # - for worker processes
    mpool.RunOnEachWorkerProcess(drive.ConfigureTerrainDriver,
                                 terrain_dir=None,
                                 cache_size=num_tiles_worker_ned)
    mpool.RunOnEachWorkerProcess(drive.ConfigureNlcdDriver,
                                 nlcd_dir=None,
                                 cache_size=num_tiles_worker_nlcd)

    #run
    client = cbsd_sas.client()

    #Authenticate
    client.server._sas_admin.Reset()
Exemplo n.º 3
0
#   + Number of parallel processes -
#     do not exceed your workstation parallel capabilities (number of core minus 2)
#     Auto mode: -1 => will derive a proper setup as 50% of your workstation capabilities
num_processes = -1
#   + Number of cached tiles (per process)
num_cached_tiles = 32

# - Internal parameters
num_montecarlo_iter = 2000
fmin, fmax = 3560, 3570
ratio_cat_a_outdoor = 1.0 - ratio_cat_b - ratio_cat_a_indoor

#----------------------------------------
# Configure the geo drivers to avoid swap
drive.ConfigureTerrainDriver(cache_size=num_cached_tiles)
drive.ConfigureNlcdDriver(cache_size=num_cached_tiles)


#----------------------------------------
# Preparing all simulation parameters
def PrepareSimulation():
    # Read the DPA zone
    print 'Preparing Zones'
    dpa_zone = zones.GetCoastalDpaZones()[dpa_name]
    dpa_geometry = dpa_zone.geometry
    us_border = zones.GetUsBorder()
    urban_areas = zones.GetUrbanAreas() if do_inside_urban_area else None
    protection_zone = zones.GetCoastalProtectionZone()

    # Distribute random CBSD of various types around the FSS.
    print 'Distributing random CBSDs in DPA neighborhood'