Test(utils, alps) { int rc; uint8_t ptag; uint32_t cookie, fmas, cqs, npes, npr; void *addr = NULL; _gnix_alps_cleanup(); rc = gnixu_get_rdma_credentials(addr, &ptag, &cookie); cr_expect(!rc); rc = _gnix_job_fma_limit(0, ptag, &fmas); cr_expect(!rc); rc = _gnix_job_cq_limit(0, ptag, &cqs); cr_expect(!rc); rc = _gnix_pes_on_node(&npes); cr_expect(!rc); rc = _gnix_nics_per_rank(&npr); cr_expect(!rc); cqs /= GNIX_CQS_PER_EP; cr_expect(((fmas > cqs ? cqs : fmas) / npes) == npr); _gnix_alps_cleanup(); }
int _gnix_nics_per_rank(uint32_t *nics_per_rank) { int rc; uint32_t npes, fmas, cqs, limiting_resource; if (!nics_per_rank) { return -FI_EINVAL; } rc = __gnix_app_init(); if (rc) { GNIX_WARN(FI_LOG_FABRIC, "__gnix_app_init() failed, ret=%d(%s)\n", rc, strerror(errno)); return rc; } rc = _gnix_job_fma_limit(gnix_device_id, gnix_app_ptag, &fmas); if (rc) { return rc; } rc = _gnix_job_cq_limit(gnix_device_id, gnix_app_ptag, &cqs); if (rc) { return rc; } gnix_cq_limit = cqs; cqs /= GNIX_CQS_PER_EP; rc = _gnix_pes_on_node(&npes); if (rc) { return rc; } limiting_resource = fmas > cqs ? cqs : fmas; *nics_per_rank = limiting_resource / npes; return FI_SUCCESS; }