Skip to content

Commit 59e56ef

Browse files
emerybergerclaude
andcommitted
Fix Phoenix benchmarks for large files and coz compatibility
- histogram, string_match: widen int → long for file sizes, loop counters, and per-thread byte counts so inputs >2 GB work correctly - pca: remove COZ_PROGRESS from calc_mean; the mean and covariance phases run sequentially, so the idle progress point always had delta=0, causing every experiment to be silently dropped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d755548 commit 59e56ef

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

benchmarks/histogram/histogram-pthread.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void *calc_hist(void *arg) {
9999
int *red;
100100
int *green;
101101
int *blue;
102-
int i;
102+
long i;
103103
thread_arg_t *thread_arg = (thread_arg_t *)arg;
104104
unsigned char *val;
105105
/*
@@ -151,8 +151,8 @@ int main(int argc, char *argv[]) {
151151
int green[256];
152152
int blue[256];
153153
int num_procs;
154-
int num_per_thread;
155-
int excess;
154+
long num_per_thread;
155+
long excess;
156156

157157

158158
// Make sure a filename is specified
@@ -193,9 +193,9 @@ int main(int argc, char *argv[]) {
193193
swap_bytes((char *)(data_pos), sizeof(*data_pos));
194194
}
195195

196-
int imgdata_bytes = (int)finfo.st_size - (int)(*(data_pos));
197-
int num_pixels = ((int)finfo.st_size - (int)(*(data_pos))) / 3;
198-
printf("This file has %d bytes of image data, %d pixels\n", imgdata_bytes,
196+
long imgdata_bytes = (long)finfo.st_size - (long)(*(data_pos));
197+
long num_pixels = ((long)finfo.st_size - (long)(*(data_pos))) / 3;
198+
printf("This file has %ld bytes of image data, %ld pixels\n", imgdata_bytes,
199199
num_pixels);
200200

201201
printf("Starting pthreads histogram\n");

benchmarks/pca/pca-pthread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ void *calc_mean(void *arg) {
146146
for (j = 0; j < num_cols; j++) {
147147
sum += matrix[i][j];
148148
}
149-
mean[i] = sum / num_cols;
150-
COZ_PROGRESS;
149+
mean[i] = sum / num_cols;
151150
}
152151

153152
return (void *)0;

benchmarks/string_match/string_match-pthread.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
#define OFFSET 5
5252

5353
typedef struct {
54-
int keys_file_len;
55-
int encrypted_file_len;
54+
long keys_file_len;
55+
long encrypted_file_len;
5656
long bytes_comp;
5757
char * keys_file;
5858
char * encrypt_file;
@@ -155,7 +155,7 @@ void string_match_splitter(void *data_in)
155155
pthread_attr_init(&attr);
156156
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
157157

158-
int req_bytes = data->keys_file_len / num_procs;
158+
long req_bytes = data->keys_file_len / num_procs;
159159

160160
str_map_data_t *map_data = (str_map_data_t*)malloc(sizeof(str_map_data_t)
161161
* num_procs);
@@ -167,8 +167,8 @@ void string_match_splitter(void *data_in)
167167
map_data[i].keys_file = data->keys_file + data->bytes_comp;
168168
map_data[i].TID = i;
169169

170-
/* Assign the required number of bytes */
171-
int available_bytes = data->keys_file_len - data->bytes_comp;
170+
/* Assign the required number of bytes */
171+
long available_bytes = data->keys_file_len - data->bytes_comp;
172172
if(available_bytes < 0)
173173
available_bytes = 0;
174174

@@ -177,7 +177,7 @@ void string_match_splitter(void *data_in)
177177

178178

179179
char* final_ptr = map_data[i].keys_file + out[i].length;
180-
int counter = data->bytes_comp + out[i].length;
180+
long counter = data->bytes_comp + out[i].length;
181181

182182
/* make sure we end at a word */
183183
while(counter <= data->keys_file_len && *final_ptr != '\n'
@@ -223,7 +223,8 @@ void *string_match_map(void *args)
223223

224224
str_map_data_t* data_in = (str_map_data_t*)( ((map_args_t*)args)->data);
225225

226-
int key_len, total_len = 0;
226+
int key_len;
227+
long total_len = 0;
227228
char * key_file = data_in->keys_file;
228229
char * cur_word = (char*)malloc(MAX_REC_LEN);
229230
char * cur_word_final = (char*)malloc(MAX_REC_LEN);

0 commit comments

Comments
 (0)