static char * get_gputop_system_path(void) { const char *bin_dir = get_bin_dir(); const char *options[] = { ".libs/lt-gputop-system", ".libs/gputop-system", "gputop-system", NULL }; for (int i = 0; options[i]; i++) { struct stat sb; char *path = NULL; if (asprintf(&path, "%s/%s", bin_dir, options[i]) < 0) { perror("Failed to format gputop-system path"); exit(1); } if (stat(path, &sb) == 0) return path; free(path); } fprintf(stderr, "Failed to find gputop-system program\n"); exit(1); }
int lamsa_index(int argc, char *argv[]) { clock_t t = clock(); char *prefix=0; int type=0, c; /*while ((c = getopt(argc, argv, "i:")) >= 0) { switch (c) { case 'i': type = atoi(optarg); if (type > 2 || type < 1) return lamsa_index_usage(); break; default: return lamsa_index_usage(); } }*/ if (optind + 2 > argc) return lamsa_index_usage(); prefix = strdup(argv[optind+1]); char *bin_dir; bin_dir = get_bin_dir(argv[0]); bwt_index(prefix); if (type==0) gem_build(bin_dir, prefix); else if (type==1) bwa_build(bin_dir, prefix); else if(type==2) soap_bulid(bin_dir, prefix); else return lamsa_index_usage(); //fprintf(stderr, "[lamsa_index] Time Consupmtion: %.3f sec.\n", (float)(clock()-t)/CLOCKS_PER_SEC); return 0; }
int get_bin(t_data *data) { char *path; char *frag; path = data->std.path; data->bin = NULL; while ((frag = get_bin_dir(&path))) { if ((get_file_dir(&data->bin, frag)) == SH_FAIL) return (SH_FAIL); free(frag); } return (SH_OK); }
/* See if gputop is being run from a source/build directory and set * the GPUTOP_WEB_ROOT environment accordingly if so, to avoid * neeing to run make install during development/testing... */ static void setup_web_root_env(void) { const char *bin_dir = get_bin_dir(); char *index_path = NULL; struct stat sb; if (getenv("GPUTOP_WEB_ROOT")) return; if (asprintf(&index_path, "%s/gputop.js", bin_dir) < 0) { fprintf(stderr, "Failed to format index.html path\n"); exit(1); } if (stat(index_path, &sb) == 0) setenv("GPUTOP_WEB_ROOT", bin_dir, 1); free(index_path); }