ywcb00 commented on code in PR #2524:
URL: https://github.com/apache/systemds/pull/2524#discussion_r3559580830


##########
src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederationMap.java:
##########
@@ -138,6 +145,27 @@ private FederatedRequest broadcast(CacheableData<?> data, 
LineageItem lineageIte
                // is fine, because with broadcast all data on all workers)
                data.setFedMapping(copyWithNewIDAndRange(
                        cb.getNumRows(), cb.getNumColumns(), id, 
FType.BROADCAST));
+
+               // === COMPRESSION INTEGRATION ===
+               // Attempt TopK compression if the block is a MatrixBlock
+               if(DMLScript.FEDERATED_COMPRESSION && cb instanceof 
MatrixBlock) {
+                       try {
+                               CompressionConfig config = 
CompressionConfig.builder()
+                                       .enable(true)
+                                       .withType(CompressionType.TOPK)
+                                       .withSparsity(0.01)
+                                       .build();

Review Comment:
   With this hard-coded configuration, the federated compression cannot be 
configured different than TOPK with 0.01 sparsity.



##########
src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederationMap.java:
##########
@@ -138,6 +145,27 @@ private FederatedRequest broadcast(CacheableData<?> data, 
LineageItem lineageIte
                // is fine, because with broadcast all data on all workers)
                data.setFedMapping(copyWithNewIDAndRange(
                        cb.getNumRows(), cb.getNumColumns(), id, 
FType.BROADCAST));
+
+               // === COMPRESSION INTEGRATION ===
+               // Attempt TopK compression if the block is a MatrixBlock
+               if(DMLScript.FEDERATED_COMPRESSION && cb instanceof 
MatrixBlock) {
+                       try {
+                               CompressionConfig config = 
CompressionConfig.builder()
+                                       .enable(true)
+                                       .withType(CompressionType.TOPK)
+                                       .withSparsity(0.01)
+                                       .build();
+                               MatrixCompressor compressor = 
CompressionFactory.create(config);
+                               CompressedMatrix compressed = 
compressor.compress((MatrixBlock) cb);
+                               MatrixBlock decompressed = 
compressor.decompress(compressed);

Review Comment:
   By compressing the matrix on the sender site and decompressing it on the 
recipient site, we can reduce the communication cost. Try to transfer the 
compressed matrix over the network and decompress it at the recipients site 
(i.e., 
[FederatedWorkerHandler.java#L475](https://github.com/apache/systemds/blob/e5578364bfe4167e6e9b289d439bfd0ae034173b/src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedWorkerHandler.java#L475)).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to