int rsreader_hwloc_load (resrc_api_ctx_t *rsapi, const char *buf, size_t len, uint32_t rank, rsreader_t r_mode, machs_t *machs, char **err_str) { int rc = -1; rssig_t *sig = NULL; hwloc_topology_t topo; if (!machs) goto done; if (hwloc_topology_init (&topo) != 0) goto done; if (hwloc_topology_set_xmlbuffer (topo, buf, len) != 0) goto err; if (hwloc_topology_load (topo) != 0) goto err; if (rs2rank_set_signature ((char*)buf, len, topo, &sig) != 0) goto err; if (rs2rank_tab_update (machs, get_hn (topo), sig, rank) != 0) goto err; if (r_mode == RSREADER_HWLOC) { const char *s = rs2rank_get_digest (sig); if (!resrc_generate_hwloc_resources (rsapi, topo, s, err_str)) goto err; } rc = 0; err: hwloc_topology_destroy (topo); done: return rc; }
//======================================================================== //======================================================================== // // NAME: static void get_g_2d(double k0, double xpos, double xposp, COMPLEX_DOUBLE& g) // DESC: Gets the 2D vacuum Green's function. // // INPUT: // // OUTPUT: // g:: the minimum value of two real numbers // // NOTES: i. !!! this is a 2d Green's function, but it seems to depend only // on x // ii. this is the Green's function in vacuum so we use k0 // //======================================================================== //======================================================================== void get_g(double k0, double xpos, double xposp, complex<double>& g) { // get the free space wavelength double lambda = 2.0*PI/k0; // get the distance between x and x' double x = fabs(xpos - xposp); // get the n=0 Hankel function of the first kind with k0*x as the arguments complex<double> h0; get_hn(0, 1, k0*x, h0); g = (PI/lambda)*h0; return; }