From af48f636b73d0400ceffee881cc426b6d3078aca Mon Sep 17 00:00:00 2001 From: Eric Lidwa Date: Tue, 13 Aug 2024 22:02:56 +0000 Subject: [PATCH] improved max batch threads for PGC strips --- packages/geo/RasterObject.cpp | 2 +- packages/geo/RasterObject.h | 2 +- plugins/pgc/plugin/PgcDemStripsRaster.cpp | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/geo/RasterObject.cpp b/packages/geo/RasterObject.cpp index c0bad5d6..335df530 100644 --- a/packages/geo/RasterObject.cpp +++ b/packages/geo/RasterObject.cpp @@ -201,7 +201,7 @@ uint32_t RasterObject::getMaxBatchThreads(void) /* Maximum number of batch threads. * Each batch thread creates multiple raster reading threads. */ - return 16; + return MAX_BATCH_THREADS; } /*---------------------------------------------------------------------------- diff --git a/packages/geo/RasterObject.h b/packages/geo/RasterObject.h index f5a01afd..b429000a 100644 --- a/packages/geo/RasterObject.h +++ b/packages/geo/RasterObject.h @@ -54,7 +54,7 @@ class RasterObject: public LuaObject /*-------------------------------------------------------------------- * Constants *--------------------------------------------------------------------*/ - + static const int MAX_BATCH_THREADS = 16; static const char* OBJECT_TYPE; static const char* LUA_META_NAME; static const struct luaL_Reg LUA_META_TABLE[]; diff --git a/plugins/pgc/plugin/PgcDemStripsRaster.cpp b/plugins/pgc/plugin/PgcDemStripsRaster.cpp index 040c5d0e..a2fcaee7 100644 --- a/plugins/pgc/plugin/PgcDemStripsRaster.cpp +++ b/plugins/pgc/plugin/PgcDemStripsRaster.cpp @@ -195,11 +195,24 @@ void PgcDemStripsRaster::getIndexFile(const OGRGeometry* geo, std::string& file) uint32_t PgcDemStripsRaster::getMaxBatchThreads(void) { /* - * The average number of strips for a point is between 10 to 20. - * There are areas where the number of strips can be over 100. - * Limit the number of batch threads to 1. + * Typically, the average number of strips for a point ranges between 10 to 20, + * but in some areas, the number can exceed 100. To avoid overwhelming the system + * in these high-density areas we limit the number of batch threads to 1 + * . */ - return 1; + uint32_t numThreads = 1; + + /* + * If we are filtering by closest time or using POI time, we only process + * the data strip raster and the quality mask raster. In this scenario, + * we allow the default number of threads to maximize performance. + */ + if(parms->filter_closest_time || parms->use_poi_time) + { + numThreads = MAX_BATCH_THREADS; + } + + return numThreads; } /*----------------------------------------------------------------------------