Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sonar-OpenFAM_ATL.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions src/atl_counters.tbl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
ATL_COUNTER(fam_get_atomic)
ATL_COUNTER(fam_put_atomic)
ATL_COUNTER(fam_scatter_atomic)
ATL_COUNTER(fam_gather_atomic)
62 changes: 35 additions & 27 deletions src/fam_atl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ int atl_finalize() {

if (serverAddrName) free(serverAddrName);

if (defaultCtx != NULL)
delete defaultCtx;
//if (defaultCtx != NULL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO comment on why this is commented out ?

// delete defaultCtx;
return 0;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand All @@ -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();
Expand All @@ -722,15 +724,15 @@ 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) {
fabric_completion_wait(ATLCtx, ctx, 1);
ret = retStatus;
fabric_deregister_mr(mr);
}
// FAM_PROFILE_END_OPS(fam_put_atomic);
ATL_PROFILE_END_OPS(fam_scatter_atomic);
} // validate_item
return ret;
}
Expand All @@ -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();
Expand All @@ -777,15 +781,15 @@ 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) {
fabric_completion_wait(ATLCtx, ctx, 1);
ret = retStatus;
fabric_deregister_mr(mr);
}
// FAM_PROFILE_END_OPS(fam_put_atomic);
ATL_PROFILE_END_OPS(fam_gather_atomic);
} // validate_item
return ret;
}
Expand All @@ -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();
Expand Down Expand Up @@ -842,15 +848,15 @@ 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) {
fabric_completion_wait(ATLCtx, ctx, 1);
ret = retStatus;
fabric_deregister_mr(mr);
}
// FAM_PROFILE_END_OPS(fam_put_atomic);
ATL_PROFILE_END_OPS(fam_scatter_atomic);
} // validate_item
return ret;
}
Expand All @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down
15 changes: 12 additions & 3 deletions test/atl_multi_get_put.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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<double> 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;
Expand Down
12 changes: 10 additions & 2 deletions test/atl_parallel_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> 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;
Expand Down
52 changes: 42 additions & 10 deletions test/fam_SG_ATL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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<double> 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;
Expand All @@ -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()
Expand All @@ -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()
Expand Down
Loading