From c0c78a03a831f435c901a885438fe5f9f8479b90 Mon Sep 17 00:00:00 2001 From: Rishikesh K Rajak Date: Tue, 26 Oct 2021 00:14:26 -0700 Subject: [PATCH 1/2] Added sonar cloud file --- sonar-OpenFAM_ATL.properties | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sonar-OpenFAM_ATL.properties diff --git a/sonar-OpenFAM_ATL.properties b/sonar-OpenFAM_ATL.properties new file mode 100644 index 0000000..fc3904f --- /dev/null +++ b/sonar-OpenFAM_ATL.properties @@ -0,0 +1,12 @@ +sonar.projectKey=rajakrishi_OpenFAM_ATL +sonar.organization=rajakrishi + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=OpenFAM_ATL +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 From bccb8466a73719d167a3b936490aede5fd2f0a57 Mon Sep 17 00:00:00 2001 From: Rishikesh K Rajak Date: Tue, 26 Oct 2021 01:01:35 -0700 Subject: [PATCH 2/2] Added verbs provider fixes for ATL App --- src/atl_counters.tbl | 2 ++ src/fam_atl.cpp | 62 +++++++++++++++++++++----------------- test/atl_multi_get_put.cpp | 15 +++++++-- test/atl_parallel_test.cpp | 12 ++++++-- test/fam_SG_ATL.cpp | 52 ++++++++++++++++++++++++++------ test/fam_atl_get_put.cpp | 50 ++++++++++++++++++++++++------ 6 files changed, 142 insertions(+), 51 deletions(-) diff --git a/src/atl_counters.tbl b/src/atl_counters.tbl index d955054..87a8f46 100644 --- a/src/atl_counters.tbl +++ b/src/atl_counters.tbl @@ -1,2 +1,4 @@ ATL_COUNTER(fam_get_atomic) ATL_COUNTER(fam_put_atomic) +ATL_COUNTER(fam_scatter_atomic) +ATL_COUNTER(fam_gather_atomic) diff --git a/src/fam_atl.cpp b/src/fam_atl.cpp index 3f86530..5c15e68 100644 --- a/src/fam_atl.cpp +++ b/src/fam_atl.cpp @@ -501,8 +501,8 @@ int atl_finalize() { if (serverAddrName) free(serverAddrName); - if (defaultCtx != NULL) - delete defaultCtx; + //if (defaultCtx != NULL) + // delete defaultCtx; return 0; } @@ -602,7 +602,7 @@ int fam_get_atomic(void *local, Fam_Descriptor *descriptor, fi_context *ctx = fabric_post_response_buff(&retStatus,(*fiAddrs)[nodeId], ATLCtx,sizeof(retStatus)); ret = famCIS->get_atomic(globalDescriptor.regionId & REGIONID_MASK, globalDescriptor.offset, offset, nbytes, - key, get_selfAddr(nodeId), get_selfAddrLen(nodeId), + key, (uint64_t)local, get_selfAddr(nodeId), get_selfAddrLen(nodeId), nodeId, uid, gid); if (ret == 0) { @@ -664,7 +664,7 @@ int fam_put_atomic(void *local, Fam_Descriptor *descriptor, ret = famCIS->put_atomic(globalDescriptor.regionId & REGIONID_MASK, globalDescriptor.offset, offset, nbytes, - key, get_selfAddr(nodeId),get_selfAddrLen(nodeId), + key, (uint64_t)local, get_selfAddr(nodeId),get_selfAddrLen(nodeId), (const char *)local, nodeId, uid, gid); if ((ret == 0) && (nbytes > MAX_DATA_IN_MSG)) { @@ -691,16 +691,18 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, int32_t retStatus = -1; fi_context *ctx = NULL; Fam_Global_Descriptor globalDescriptor; - // FAM_CNTR_INC_API(fam_put_atomic); - // FAM_PROFILE_START_ALLOCATOR(fam_put_atomic); + + ATL_CNTR_INC_API(fam_scatter_atomic); + ATL_PROFILE_START_ALLOCATOR(fam_scatter_atomic); if ((local == NULL) || (descriptor == NULL) || (nElements == 0)) { message << "Invalid Options"; THROW_ATL_ERR_MSG(ATL_Exception, message.str().c_str()); } ret = validate_item(descriptor); - // FAM_PROFILE_END_ALLOCATOR(fam_put_atomic); - // FAM_PROFILE_START_OPS(fam_put_atomic); + ATL_PROFILE_END_ALLOCATOR(fam_scatter_atomic); + ATL_PROFILE_START_OPS(fam_scatter_atomic); + if (ret == 0) { // Read data from FAM region with this key globalDescriptor = descriptor->get_global_descriptor(); @@ -722,7 +724,7 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, ret = famCIS->scatter_strided_atomic( globalDescriptor.regionId & REGIONID_MASK, globalDescriptor.offset, - nElements, firstElement, stride, elementSize, key, get_selfAddr(nodeId), + nElements, firstElement, stride, elementSize, key, (uint64_t) local, get_selfAddr(nodeId), get_selfAddrLen(nodeId), nodeId, uid, gid); if (ret == 0) { @@ -730,7 +732,7 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, ret = retStatus; fabric_deregister_mr(mr); } - // FAM_PROFILE_END_OPS(fam_put_atomic); + ATL_PROFILE_END_OPS(fam_scatter_atomic); } // validate_item return ret; } @@ -746,16 +748,18 @@ int fam_gather_atomic(void *local, Fam_Descriptor *descriptor, int32_t retStatus = -1; fi_context *ctx = NULL; Fam_Global_Descriptor globalDescriptor; - // FAM_CNTR_INC_API(fam_put_atomic); - // FAM_PROFILE_START_ALLOCATOR(fam_put_atomic); + ATL_CNTR_INC_API(fam_gather_atomic); + ATL_PROFILE_START_ALLOCATOR(fam_gather_atomic); + if ((local == NULL) || (descriptor == NULL) || (nElements == 0)) { message << "Invalid Options"; THROW_ATL_ERR_MSG(ATL_Exception, message.str().c_str()); } ret = validate_item(descriptor); - // FAM_PROFILE_END_ALLOCATOR(fam_put_atomic); - // FAM_PROFILE_START_OPS(fam_put_atomic); + ATL_PROFILE_END_ALLOCATOR(fam_gather_atomic); + ATL_PROFILE_START_OPS(fam_gather_atomic); + if (ret == 0) { // Read data from FAM region with this key globalDescriptor = descriptor->get_global_descriptor(); @@ -777,7 +781,7 @@ int fam_gather_atomic(void *local, Fam_Descriptor *descriptor, ret = famCIS->gather_strided_atomic( globalDescriptor.regionId & REGIONID_MASK, globalDescriptor.offset, - nElements, firstElement, stride, elementSize, key, get_selfAddr(nodeId), + nElements, firstElement, stride, elementSize, key, (uint64_t) local, get_selfAddr(nodeId), get_selfAddrLen(nodeId), nodeId, uid, gid); if (ret == 0) { @@ -785,7 +789,7 @@ int fam_gather_atomic(void *local, Fam_Descriptor *descriptor, ret = retStatus; fabric_deregister_mr(mr); } - // FAM_PROFILE_END_OPS(fam_put_atomic); + ATL_PROFILE_END_OPS(fam_gather_atomic); } // validate_item return ret; } @@ -801,16 +805,18 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, int32_t retStatus = -1; fi_context *ctx = NULL; Fam_Global_Descriptor globalDescriptor; - // FAM_CNTR_INC_API(fam_put_atomic); - // FAM_PROFILE_START_ALLOCATOR(fam_put_atomic); + ATL_CNTR_INC_API(fam_scatter_atomic); + ATL_PROFILE_START_ALLOCATOR(fam_scatter_atomic); + if ((local == NULL) || (descriptor == NULL) || (nElements == 0)) { message << "Invalid Options"; THROW_ATL_ERR_MSG(ATL_Exception, message.str().c_str()); } ret = validate_item(descriptor); - // FAM_PROFILE_END_ALLOCATOR(fam_put_atomic); - // FAM_PROFILE_START_OPS(fam_put_atomic); + ATL_PROFILE_END_ALLOCATOR(fam_scatter_atomic); + ATL_PROFILE_START_OPS(fam_scatter_atomic); + if (ret == 0) { // Read data from FAM region with this key globalDescriptor = descriptor->get_global_descriptor(); @@ -842,7 +848,7 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, ret = famCIS->scatter_indexed_atomic( globalDescriptor.regionId & REGIONID_MASK, globalDescriptor.offset, - nElements, string(indexStr.str()).c_str(), elementSize, key, + nElements, string(indexStr.str()).c_str(), elementSize, key, (uint64_t) local, get_selfAddr(nodeId), get_selfAddrLen(nodeId), nodeId, uid, gid); if (ret == 0) { @@ -850,7 +856,7 @@ int fam_scatter_atomic(void *local, Fam_Descriptor *descriptor, ret = retStatus; fabric_deregister_mr(mr); } - // FAM_PROFILE_END_OPS(fam_put_atomic); + ATL_PROFILE_END_OPS(fam_scatter_atomic); } // validate_item return ret; } @@ -865,16 +871,18 @@ int fam_gather_atomic(void *local, Fam_Descriptor *descriptor, int32_t retStatus = -1; fi_context *ctx = NULL; Fam_Global_Descriptor globalDescriptor; - // FAM_CNTR_INC_API(fam_put_atomic); - // FAM_PROFILE_START_ALLOCATOR(fam_put_atomic); + ATL_CNTR_INC_API(fam_gather_atomic); + ATL_PROFILE_START_ALLOCATOR(fam_gather_atomic); + if ((local == NULL) || (descriptor == NULL) || (nElements == 0)) { message << "Invalid Options"; THROW_ATL_ERR_MSG(ATL_Exception, message.str().c_str()); } ret = validate_item(descriptor); - // FAM_PROFILE_END_ALLOCATOR(fam_put_atomic); - // FAM_PROFILE_START_OPS(fam_put_atomic); + ATL_PROFILE_END_ALLOCATOR(fam_gather_atomic); + ATL_PROFILE_START_OPS(fam_gather_atomic); + if (ret == 0) { // Read data from FAM region with this key globalDescriptor = descriptor->get_global_descriptor(); @@ -914,7 +922,7 @@ int fam_gather_atomic(void *local, Fam_Descriptor *descriptor, ret = retStatus; fabric_deregister_mr(mr); } - // FAM_PROFILE_END_OPS(fam_put_atomic); + ATL_PROFILE_END_OPS(fam_gather_atomic); } // validate_item return ret; } diff --git a/test/atl_multi_get_put.cpp b/test/atl_multi_get_put.cpp index e3ee5fc..81ed346 100644 --- a/test/atl_multi_get_put.cpp +++ b/test/atl_multi_get_put.cpp @@ -101,7 +101,7 @@ int main() { dataRegion = my_fam->fam_lookup_region(DATA_REGION); } catch (Fam_Exception &e) { cout << "data Region not found" << endl; - dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, RAID1); + dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, NULL); } char msg1[200] = {0}; char msg2[200] = {0}; @@ -115,12 +115,21 @@ int main() { for (i = 0; i < 200; i++) msg1[i] = 'X'; auto start = std::chrono::high_resolution_clock::now(); - myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + } catch(Fam_Exception &e) { + cout << "fam_gett_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "get atomic elapsed time: " << elapsed_seconds.count() << endl; diff --git a/test/atl_parallel_test.cpp b/test/atl_parallel_test.cpp index 5f1832f..fb1a995 100644 --- a/test/atl_parallel_test.cpp +++ b/test/atl_parallel_test.cpp @@ -120,12 +120,20 @@ int main(int argc, char *argv[]) { auto start = std::chrono::high_resolution_clock::now(); for (i = 0; i < NUM_ITERATIONS; i++) { compflag = false; - myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "get atomic elapsed time: " << elapsed_seconds.count() << endl; diff --git a/test/fam_SG_ATL.cpp b/test/fam_SG_ATL.cpp index 02f9171..382b671 100644 --- a/test/fam_SG_ATL.cpp +++ b/test/fam_SG_ATL.cpp @@ -94,7 +94,7 @@ int main() { dataRegion = my_fam->fam_lookup_region(DATA_REGION); } catch (Fam_Exception &e) { cout << "data Region not found" << endl; - dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, RAID1); + dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, NULL); } char msg1[200] = {0}; char msg2[200] = {0}; @@ -108,17 +108,25 @@ int main() { for (i = 0; i < 200; i++) msg1[i] = 'X'; auto start = std::chrono::high_resolution_clock::now(); - myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); // strlen(msg1)); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); // strlen(msg1)); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "get atomic elapsed time: " << elapsed_seconds.count() << endl; cout << msg2 << endl; - if (strcmp(msg1, msg2) != 0) + if (strncmp(msg1, msg2, 200) != 0) cout << "Test1: Comparison of full string failed" << endl; else cout << "Test1: Comparison of full string successful" << endl; @@ -128,17 +136,29 @@ int main() { // sleep(30); cout << "Scatter atomic - strided" << endl; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_scatter_atomic(msg1, item1, 5, 1, 2, 2); + try { + myatlib->fam_scatter_atomic(msg1, item1, 5, 1, 2, 2); + } catch(Fam_Exception &e) { + cout << "fam_scatter_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "Scatter strided atomic elapsed time: " << elapsed_seconds.count() << endl; - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; cout << "Gather atomic - strided" << endl; memset(msg2, 0, 200); start = std::chrono::high_resolution_clock::now(); - myatlib->fam_gather_atomic(msg2, item1, 5, 1, 2, 2); + try { + myatlib->fam_gather_atomic(msg2, item1, 5, 1, 2, 2); + } catch(Fam_Exception &e) { + cout << "fam_gather_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "Gather strided atomic elapsed time: " << elapsed_seconds.count() @@ -153,17 +173,29 @@ int main() { msg1[i] = 'Z'; uint64_t indexes[] = {10, 17, 13, 15, 30}; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_scatter_atomic(msg1, item1, 5, indexes, 2); + try { + myatlib->fam_scatter_atomic(msg1, item1, 5, indexes, 2); + } catch(Fam_Exception &e) { + cout << "fam_scatter_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "Scatter indexed atomic elapsed time: " << elapsed_seconds.count() << endl; - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; cout << "Gather atomic - indexed" << endl; memset(msg2, 0, 200); start = std::chrono::high_resolution_clock::now(); - myatlib->fam_gather_atomic(msg2, item1, 5, indexes, 2); + try { + myatlib->fam_gather_atomic(msg2, item1, 5, indexes, 2); + } catch(Fam_Exception &e) { + cout << "fam_gather_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "Gather indexed atomic elapsed time: " << elapsed_seconds.count() diff --git a/test/fam_atl_get_put.cpp b/test/fam_atl_get_put.cpp index 0b5ac10..9f3d3ac 100644 --- a/test/fam_atl_get_put.cpp +++ b/test/fam_atl_get_put.cpp @@ -100,7 +100,7 @@ int main() { dataRegion = my_fam->fam_lookup_region(DATA_REGION); } catch (Fam_Exception &e) { cout << "data Region not found" << endl; - dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, RAID1); + dataRegion = my_fam->fam_create_region(DATA_REGION, 1048576, 0777, NULL); } char msg1[200] = {0}; char msg2[200] = {0}; @@ -114,12 +114,20 @@ int main() { for (i = 0; i < 200; i++) msg1[i] = 'X'; auto start = std::chrono::high_resolution_clock::now(); - myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); // strlen(msg1)); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "get atomic elapsed time: " << elapsed_seconds.count() << endl; @@ -137,12 +145,20 @@ int main() { msg1[i] = 'Y'; memset(msg2, 0, 200); start = std::chrono::high_resolution_clock::now(); - myatlib->fam_put_atomic((void *)msg1, item1, 20, 150); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 20, 150); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; - myatlib->fam_get_atomic((void *)msg2, item1, 20, 150); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 20, 150); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; if (strncmp(msg2, strchr(msg1, 'Y'), 150) == 0) cout << "Test 2: Comaparion of partial string successful" << endl; @@ -150,7 +166,11 @@ int main() { cout << "Test 2:Comaparion of partial string failed" << endl; cout << "reading the complete data" << endl; memset(msg2, 0, 200); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; for (i = 0; i < 20; i++) { if (msg2[i] != 'X') @@ -177,12 +197,20 @@ int main() { for (i = 0; i < 200; i++) msg1[i] = 'Z'; start = std::chrono::high_resolution_clock::now(); - myatlib->fam_put_atomic((void *)msg1, item1, 50, 100); + try { + myatlib->fam_put_atomic((void *)msg1, item1, 50, 100); + } catch(Fam_Exception &e) { + cout << "fam_put_atomic failed" << e.fam_error_msg() << endl; + } end = std::chrono::high_resolution_clock::now(); elapsed_seconds = end - start; cout << "put atomic elapsed time: " << elapsed_seconds.count() << endl; - myatlib->fam_get_atomic((void *)msg2, item1, 50, 100); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 50, 100); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; if (strncmp(msg2, strchr(msg1, 'Z'), 100) == 0) cout << "Comaparion of partial string successful" << endl; @@ -191,7 +219,11 @@ int main() { cout << "reading the complete data" << endl; memset(msg2, 0, 200); - myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + try { + myatlib->fam_get_atomic((void *)msg2, item1, 0, 200); + } catch(Fam_Exception &e) { + cout << "fam_get_atomic failed" << e.fam_error_msg() << endl; + } cout << msg2 << endl; for (i = 0; i < 20; i++) { if (msg2[i] != 'X')