int add_suffix_to_output_names(t_filenm *fnm, int nfile, const char *suffix) { int i, j, pos; char buf[STRLEN], newname[STRLEN]; char *extpos; for (i = 0; i < nfile; i++) { if (is_output(&fnm[i]) && fnm[i].ftp != efCPT) { /* We never use multiple _outputs_, but we might as well check for it, just in case... */ for (j = 0; j < fnm[i].nfiles; j++) { strncpy(buf, fnm[i].fns[j], STRLEN - 1); extpos = strrchr(buf, '.'); *extpos = '\0'; sprintf(newname, "%s%s.%s", buf, suffix, extpos + 1); free(fnm[i].fns[j]); fnm[i].fns[j] = strdup(newname); } } } return 0; }
void view_all(int nf, t_filenm fnm[]) { int i; for(i=0; i<nf; i++) if ( can_view(fnm[i].ftp) && is_output(&(fnm[i])) && ( ! is_optional(&(fnm[i])) || is_set(&(fnm[i])) ) ) do_view(fnm[i].fn, NULL); }
void lifTSDIOPin::turn_on() { if (!is_output()) output(); if (enabledLow) { low(); } else { high(); } }
void view_all(const output_env_t oenv,int nf, t_filenm fnm[]) { int i; for(i=0; i<nf; i++) if ( can_view(fnm[i].ftp) && is_output(&(fnm[i])) && ( ! is_optional(&(fnm[i])) || is_set(&(fnm[i])) ) ) do_view(oenv,fnm[i].fns[0], NULL); }
/** \brief Convert this object to a std::string */ std::string fdwatch_cond_t::to_string() const throw() { std::ostringstream oss; oss << "["; if( is_input() ) oss << "(input)"; if( is_output() ) oss << "(output)"; if( is_error() ) oss << "(error)"; oss << "]"; // return the built string return oss.str(); }
void view_all(const gmx_output_env_t *oenv, int nf, t_filenm fnm[]) { int i; for (i = 0; i < nf; i++) { if (can_view(fnm[i].ftp) && is_output(&(fnm[i])) && ( !is_optional(&(fnm[i])) || is_set(&(fnm[i])) ) ) { do_view(oenv, fnm[i].filenames[0].c_str(), nullptr); } } }
/*! \brief Search for \p fnm_cp in fnm and return true iff found * * \todo This could be implemented sanely with a for loop. */ static gmx_bool exist_output_file(const char *fnm_cp, int nfile, const t_filenm fnm[]) { int i; /* Check if the output file name stored in the checkpoint file * is one of the output file names of mdrun. */ i = 0; while (i < nfile && !(is_output(&fnm[i]) && strcmp(fnm_cp, fnm[i].fns[0]) == 0)) { i++; } return (i < nfile && gmx_fexist(fnm_cp)); }
nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); if ((mode == nir_var_shader_in && is_input(intrin)) || (mode == nir_var_shader_out && is_output(intrin))) { nir_src *offset = nir_get_io_offset_src(intrin); nir_const_value *const_offset = nir_src_as_const_value(*offset); if (const_offset) { intrin->const_index[0] += const_offset->u32[0]; b->cursor = nir_before_instr(&intrin->instr); nir_instr_rewrite_src(&intrin->instr, offset, nir_src_for_ssa(nir_imm_int(b, 0))); } } }
void init_multisystem(t_commrec *cr, int nsim, char **multidirs, int nfile, const t_filenm fnm[], gmx_bool bParFn) { gmx_multisim_t *ms; int nnodes, nnodpersim, sim, i, ftp; char buf[256]; #ifdef GMX_MPI MPI_Group mpi_group_world; int *rank; #endif #ifndef GMX_MPI if (nsim > 1) { gmx_fatal(FARGS, "This binary is compiled without MPI support, can not do multiple simulations."); } #endif nnodes = cr->nnodes; if (nnodes % nsim != 0) { gmx_fatal(FARGS, "The number of ranks (%d) is not a multiple of the number of simulations (%d)", nnodes, nsim); } nnodpersim = nnodes/nsim; sim = cr->nodeid/nnodpersim; if (debug) { fprintf(debug, "We have %d simulations, %d ranks per simulation, local simulation is %d\n", nsim, nnodpersim, sim); } snew(ms, 1); cr->ms = ms; ms->nsim = nsim; ms->sim = sim; #ifdef GMX_MPI /* Create a communicator for the master nodes */ snew(rank, ms->nsim); for (i = 0; i < ms->nsim; i++) { rank[i] = i*nnodpersim; } MPI_Comm_group(MPI_COMM_WORLD, &mpi_group_world); MPI_Group_incl(mpi_group_world, nsim, rank, &ms->mpi_group_masters); sfree(rank); MPI_Comm_create(MPI_COMM_WORLD, ms->mpi_group_masters, &ms->mpi_comm_masters); #if !defined(MPI_IN_PLACE_EXISTS) /* initialize the MPI_IN_PLACE replacement buffers */ snew(ms->mpb, 1); ms->mpb->ibuf = NULL; ms->mpb->libuf = NULL; ms->mpb->fbuf = NULL; ms->mpb->dbuf = NULL; ms->mpb->ibuf_alloc = 0; ms->mpb->libuf_alloc = 0; ms->mpb->fbuf_alloc = 0; ms->mpb->dbuf_alloc = 0; #endif #endif /* Reduce the intra-simulation communication */ cr->sim_nodeid = cr->nodeid % nnodpersim; cr->nnodes = nnodpersim; #ifdef GMX_MPI MPI_Comm_split(MPI_COMM_WORLD, sim, cr->sim_nodeid, &cr->mpi_comm_mysim); cr->mpi_comm_mygroup = cr->mpi_comm_mysim; cr->nodeid = cr->sim_nodeid; #endif if (debug) { fprintf(debug, "This is simulation %d", cr->ms->sim); if (PAR(cr)) { fprintf(debug, ", local number of ranks %d, local rank ID %d", cr->nnodes, cr->sim_nodeid); } fprintf(debug, "\n\n"); } if (multidirs) { if (debug) { fprintf(debug, "Changing to directory %s\n", multidirs[cr->ms->sim]); } gmx_chdir(multidirs[cr->ms->sim]); } else if (bParFn) { /* Patch output and tpx, cpt and rerun input file names */ for (i = 0; (i < nfile); i++) { /* Because of possible multiple extensions per type we must look * at the actual file name */ if (is_output(&fnm[i]) || fnm[i].ftp == efTPX || fnm[i].ftp == efCPT || strcmp(fnm[i].opt, "-rerun") == 0) { ftp = fn2ftp(fnm[i].fns[0]); par_fn(fnm[i].fns[0], ftp, cr, TRUE, FALSE, buf, 255); sfree(fnm[i].fns[0]); fnm[i].fns[0] = gmx_strdup(buf); } } } }
void init_multisystem(t_commrec *cr,int nsim, int nfile,t_filenm fnm[],bool bParFn) { gmx_multisim_t *ms; int nnodes,nnodpersim,sim,i,ftp; char buf[256]; #ifdef GMX_MPI MPI_Group mpi_group_world; #endif int *rank; nnodes = cr->nnodes; if (nnodes % nsim != 0) gmx_fatal(FARGS,"The number of nodes (%d) is not a multiple of the number of simulations (%d)",nnodes,nsim); nnodpersim = nnodes/nsim; sim = cr->nodeid/nnodpersim; if (debug) fprintf(debug,"We have %d simulations, %d nodes per simulation, local simulation is %d\n",nsim,nnodpersim,sim); snew(ms,1); cr->ms = ms; ms->nsim = nsim; ms->sim = sim; #ifdef GMX_MPI /* Create a communicator for the master nodes */ snew(rank,ms->nsim); for(i=0; i<ms->nsim; i++) rank[i] = i*nnodpersim; MPI_Comm_group(MPI_COMM_WORLD,&mpi_group_world); MPI_Group_incl(mpi_group_world,nsim,rank,&ms->mpi_group_masters); sfree(rank); MPI_Comm_create(MPI_COMM_WORLD,ms->mpi_group_masters, &ms->mpi_comm_masters); #endif /* Reduce the intra-simulation communication */ cr->sim_nodeid = cr->nodeid % nnodpersim; cr->nnodes = nnodpersim; #ifdef GMX_MPI MPI_Comm_split(MPI_COMM_WORLD,sim,cr->sim_nodeid,&cr->mpi_comm_mysim); cr->mpi_comm_mygroup = cr->mpi_comm_mysim; cr->nodeid = cr->sim_nodeid; #endif if (debug) { fprintf(debug,"This is simulation %d",cr->ms->sim); if (PAR(cr)) fprintf(debug,", local number of nodes %d, local nodeid %d", cr->nnodes,cr->sim_nodeid); fprintf(debug,"\n\n"); } if (bParFn) { /* Patch output and tpx file names (except log which has been done already) */ for(i=0; (i<nfile); i++) { /* Because of possible multiple extensions per type we must look * at the actual file name */ if (is_output(&fnm[i]) || fnm[i].ftp == efTPX || fnm[i].ftp == efCPT || strcmp(fnm[i].opt,"-rerun") == 0) { ftp = fn2ftp(fnm[i].fns[0]); par_fn(fnm[i].fns[0],ftp,cr,FALSE,buf,255); sfree(fnm[i].fns[0]); fnm[i].fns[0] = strdup(buf); } } } }
void lifTSDIOPin::low() { if (!is_output()) output(); valueMA.set_bit_low(bitNumber); }
void lifTSDIOPin::high() { if (!is_output()) output(); valueMA.set_bit_high(bitNumber); }
int is_input_image(const struct dirent *de) { return is_image(de) && !is_output(de); }
void list_subdevice_info(snd_ctl_t *ctl, int card, int device) { snd_rawmidi_info_t *info; const char *name; const char *sub_name; int subs, subs_in, subs_out; int sub, in, out; int status; snd_rawmidi_info_alloca(&info); snd_rawmidi_info_set_device(info, device); snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT); snd_ctl_rawmidi_info(ctl, info); subs_in = snd_rawmidi_info_get_subdevices_count(info); snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT); snd_ctl_rawmidi_info(ctl, info); subs_out = snd_rawmidi_info_get_subdevices_count(info); subs = subs_in > subs_out ? subs_in : subs_out; sub = 0; in = out = 0; if ((status = is_output(ctl, card, device, sub)) < 0) { error("cannot get rawmidi information %d:%d: %s", card, device, snd_strerror(status)); return; } else if (status) out = 1; if (status == 0) { if ((status = is_input(ctl, card, device, sub)) < 0) { error("cannot get rawmidi information %d:%d: %s", card, device, snd_strerror(status)); return; } } else if (status) in = 1; if (status == 0) return; name = snd_rawmidi_info_get_name(info); sub_name = snd_rawmidi_info_get_subdevice_name(info); if (sub_name[0] == '\0') { if (subs == 1) { printf("%c%c hw:%d,%d %s\n", in ? 'I' : ' ', out ? 'O' : ' ', card, device, name); } else printf("%c%c hw:%d,%d %s (%d subdevices)\n", in ? 'I' : ' ', out ? 'O' : ' ', card, device, name, subs); } else { sub = 0; for (;;) { printf("%c%c hw:%d,%d,%d %s\n", in ? 'I' : ' ', out ? 'O' : ' ', card, device, sub, sub_name); if (++sub >= subs) break; in = is_input(ctl, card, device, sub); out = is_output(ctl, card, device, sub); snd_rawmidi_info_set_subdevice(info, sub); if (out) { snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT); if ((status = snd_ctl_rawmidi_info(ctl, info)) < 0) { error("cannot get rawmidi information %d:%d:%d: %s", card, device, sub, snd_strerror(status)); break; } } else { snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT); if ((status = snd_ctl_rawmidi_info(ctl, info)) < 0) { error("cannot get rawmidi information %d:%d:%d: %s", card, device, sub, snd_strerror(status)); break; } } sub_name = snd_rawmidi_info_get_subdevice_name(info); } } }