int main(void) { // Read input file main_read_input(); // Read and sort output directory for finding files within our time limits init_part_files(); init_flow_files(); // Create output directory create_output_dir(); // Get number of particles nparts = cgns_read_nparts(); // Initialize domain and flow arrays domain_init(); // Initialize partstruct and flow vars parts_init(); flow_init(); // Messy hack for taking advantage of CUDA_VISIBLE_DEVICES in SLURM dev_start = read_devices(); // Allocate device memory cuda_dev_malloc(); cuda_dom_push(); //cuda_part_push(); //cuda_part_pull(); // Calculate tetrad stats for (tt = 0; tt < nFiles; tt++) { // Read in new data and push to device cgns_fill_flow(); cuda_flow_push(); // Calculate phase average cuda_phase_averaged_vel(); } // write phaseAvereaged to file write_part_data(); // Free and exit free_vars(); cuda_dev_free(); return EXIT_SUCCESS; }
int main(int ac, char** av) { struct s98context context; struct s98context* ctx = &context; struct s98header* h = &context.header; FILE* fp; if(ac != 2) { fprintf(stderr, "Usage: %s filename.s98\n", *av); return 1; } fp = fopen(*++av, "rb"); if(fp == NULL) { perror(*av); return -1; } memset(ctx, 0, sizeof context); fseek(fp, 0, SEEK_END); ctx->s98_size = ftell(fp); ctx->s98_buffer = malloc(ctx->s98_size); rewind(fp); fread(ctx->s98_buffer, 1, ctx->s98_size, fp); set_offset(ctx, 0); fclose(fp); if(read_header(ctx) != 0) goto cleanup; read_devices(ctx); printf("; S98 File: %s\n", *av); printf("; Offset to tag: 0x%08x (0 if none)\n", h->offset_to_tag); printf("; Dump start: 0x%08x\n", h->offset_to_dump); printf("; Loop start: 0x%08x (0 if non-looped)\n", h->offset_to_loop); printf("#version %d\n", h->version); printf("#timer %d/%d\n", h->timer_numerator, h->timer_denominator); read_tag(ctx); putchar('\n'); { int i; for(i = 0; i < h->device_count; i++) { struct s98deviceinfo* info; info = ctx->devices + i; printf("#device %s %d $%02x\n", device_name(info->device), info->clock, info->panpot); } } putchar('\n'); s98d_dump(ctx); putchar('\n'); cleanup: free_context(&context); return 0; }