当前位置: 首页>>代码示例>>C++>>正文


C++ VMDApp::par_size方法代码示例

本文整理汇总了C++中VMDApp::par_size方法的典型用法代码示例。如果您正苦于以下问题:C++ VMDApp::par_size方法的具体用法?C++ VMDApp::par_size怎么用?C++ VMDApp::par_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VMDApp的用法示例。


在下文中一共展示了VMDApp::par_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vmdinfo_tcl


//.........这里部分代码省略.........
      long vmdcorefree = vmd_get_avail_physmem_mb();
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(vmdcorefree));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }


    // return the number of available CPU cores
    if (!strcmp(argv[1], "numcpus")) {
#if defined(VMDTHREADS)
      int numcpus = wkf_thread_numprocessors();
#else
      int numcpus = 1;
#endif
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(numcpus));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }


    // return the CPU affinity list for the VMD process
    if (!strcmp(argv[1], "cpuaffinity")) {
      int numcpus = -1;
      int *cpuaffinitylist = NULL;

#if defined(VMDTHREADS)
      cpuaffinitylist = wkf_cpu_affinitylist(&numcpus);
#endif
      if (numcpus > 0 && cpuaffinitylist != NULL) {
        int i;
        Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
        for (i=0; i<numcpus; i++)
          Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(cpuaffinitylist[i]));
        Tcl_SetObjResult(interp, tcl_result);
        return TCL_OK;
      }

      if (cpuaffinitylist != NULL)
        free(cpuaffinitylist);

      Tcl_AppendResult(interp, "CPU affinity query unavailable on this platform", NULL);
      return TCL_ERROR;
    }


    // return the number of available CUDA devices
    if (!strcmp(argv[1], "numcudadevices")) {
      int numdevices;
#if defined(VMDCUDA)
      vmd_cuda_num_devices(&numdevices);
#else
      numdevices = 0;
#endif
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(numdevices));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }

    // return the active display device (e.g. "text", "win", "cave", ...)
    if (!strcmp(argv[1], "dispdev")) {
      const char *disp = VMDgetDisplayTypeName();
      Tcl_AppendResult(interp, disp, NULL);
      return TCL_OK;
    }

    // return the MPI node name 
    if (!strcmp(argv[1], "nodename")) {
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewStringObj(app->par_name(), strlen(app->par_name())));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }  

    // return the MPI node rank 
    if (!strcmp(argv[1], "noderank")) {
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(app->par_rank()));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }  

    // return the MPI node count
    if (!strcmp(argv[1], "nodecount")) {
      Tcl_Obj *tcl_result = Tcl_NewListObj(0, NULL);
      Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewIntObj(app->par_size()));
      Tcl_SetObjResult(interp, tcl_result);
      return TCL_OK;
    }  
  }

  Tcl_AppendResult(interp,
    "vmdinfo: version | versionmsg | authors | arch | \n"
    "freemem | numcpus | cpuaffinity | numcudadevices | \n"
    "dispdev | nodename | noderank | nodecount | \n"
    "options | www | wwwhelp", NULL);
  return TCL_ERROR;
}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:101,代码来源:tcl_commands.C


注:本文中的VMDApp::par_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。