From b4ca77bdefd8ba179b02a6bcce6ce97a313ba7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=A0panger?= Date: Thu, 18 Apr 2024 18:27:17 +0200 Subject: [PATCH] fix travel table interpolation --- GQHypocenterSearch/src/globalquake.hpp | 2 ++ GQHypocenterSearch/src/hypocenter_search.cu | 7 +++---- GQHypocenterSearch/src/main.cpp | 2 ++ GQHypocenterSearch/src/travel_table.cpp | 2 +- .../core/training/EarthquakeAnalysisTraining.java | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/GQHypocenterSearch/src/globalquake.hpp b/GQHypocenterSearch/src/globalquake.hpp index bfb4d9910..6a083e162 100644 --- a/GQHypocenterSearch/src/globalquake.hpp +++ b/GQHypocenterSearch/src/globalquake.hpp @@ -22,4 +22,6 @@ bool run_hypocenter_search(float *stations, bool init_depth_profiles(float *resols, int count); +size_t get_total_allocation_size(size_t points, size_t station_count, float depth_resolution); + #endif // _GLOBALQUAKE_H \ No newline at end of file diff --git a/GQHypocenterSearch/src/hypocenter_search.cu b/GQHypocenterSearch/src/hypocenter_search.cu index 3be2357ba..05dea62aa 100644 --- a/GQHypocenterSearch/src/hypocenter_search.cu +++ b/GQHypocenterSearch/src/hypocenter_search.cu @@ -11,6 +11,7 @@ #define BLOCK_REDUCE 256 #define BLOCK_DISTANCES 64 #define TILE 5 +#define SHARED_TRAVEL_TABLE_SIZE 256 #define STATION_FILEDS 4 #define HYPOCENTER_FILEDS 5 @@ -26,9 +27,7 @@ * lat, lon, depth, origin */ -#define SHARED_TRAVEL_TABLE_SIZE 512 #define MAX_ANG_VIRTUAL (181.0f) - #define PHI2 2.618033989f #define PI 3.14159256f @@ -223,7 +222,7 @@ __global__ void evaluate_hypocenter(float *results, float origins[TILE]; - int j = ((blockIdx.y * TILE) + blockIdx.x) % station_count; + int j = ((blockIdx.y * TILE) + point_index) % station_count; // trick with changing station that is being used for origin calculation { @@ -442,7 +441,7 @@ bool run_hypocenter_search(float *stations, const int block_count = ceil(static_cast(points) / BLOCK_DISTANCES); TRACE(1, "Station array size (%ld stations) %.2fkB\n", station_count, station_array_size / (1024.0)); - TRACE(1, "Station distances array size %.2fkB\n", station_distances_array_size / (1024.0)); + TRACE(1, "Station distances array size %.2fMB\n", station_distances_array_size / (1024.0 * 1024.0)); TRACE(1, "Temp results array size %.2fkB\n", (sizeof(float) * HYPOCENTER_FILEDS * temp_results_array_elements) / (1024.0)); TRACE(1, "Results array has size %.2fMB\n", (results_size / (1024.0 * 1024.0))); diff --git a/GQHypocenterSearch/src/main.cpp b/GQHypocenterSearch/src/main.cpp index 382fa19b5..3fea55d60 100644 --- a/GQHypocenterSearch/src/main.cpp +++ b/GQHypocenterSearch/src/main.cpp @@ -78,6 +78,8 @@ int main() { printf("best: %.2fpps\n", best_pps); + printf("allocation size %.2fkB\n", get_total_allocation_size(points, st_c, depth_resolution) / 1024.0); + cleanup: if (p_wave_travel_table) { free(p_wave_travel_table); diff --git a/GQHypocenterSearch/src/travel_table.cpp b/GQHypocenterSearch/src/travel_table.cpp index 0854596c9..708215906 100644 --- a/GQHypocenterSearch/src/travel_table.cpp +++ b/GQHypocenterSearch/src/travel_table.cpp @@ -18,7 +18,7 @@ float p_wave_interpolate(float ang, float depth) { int row_floor = fmin(table_rows - 2, floor(row)); int col_floor = fmin(table_columns - 2, floor(column)); int row_ceil = row_floor + 1; - int col_ceil = col_floor; + int col_ceil = col_floor + 1; float row_frac = row - row_floor; float col_frac = column - col_floor; diff --git a/GlobalQuakeCore/src/main/java/globalquake/core/training/EarthquakeAnalysisTraining.java b/GlobalQuakeCore/src/main/java/globalquake/core/training/EarthquakeAnalysisTraining.java index 1a1c6de07..64141c11b 100644 --- a/GlobalQuakeCore/src/main/java/globalquake/core/training/EarthquakeAnalysisTraining.java +++ b/GlobalQuakeCore/src/main/java/globalquake/core/training/EarthquakeAnalysisTraining.java @@ -40,7 +40,7 @@ public static void main(String[] args) throws Exception { long a = System.currentTimeMillis(); List times = new ArrayList<>(); - int runs = 500; + int runs = 5000; String units = "km";