or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/maven-org-nd4j--nd4j-parameter-server-client

A distributed parameter server client component for ND4J, enabling parameter synchronization across multiple nodes in distributed machine learning workloads

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.nd4j/nd4j-parameter-server-client@0.9.x

To install, run

npx @tessl/cli install tessl/maven-org-nd4j--nd4j-parameter-server-client@0.9.0

index.mddocs/

ND4J Parameter Server Client

ND4J Parameter Server Client is a distributed parameter server client component for ND4J (N-Dimensional Arrays for Java), enabling parameter synchronization across multiple nodes in distributed machine learning workloads. It serves as the client-side interface for communicating with parameter servers in distributed training scenarios.

Package Information

  • Package Name: nd4j-parameter-server-client
  • Package Type: maven
  • Language: Java
  • Group ID: org.nd4j
  • Artifact ID: nd4j-parameter-server-client
  • Installation: Add to Maven dependencies:
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-parameter-server-client</artifactId>
    <version>0.9.1</version>
</dependency>

Core Imports

import org.nd4j.parameterserver.client.ParameterServerClient;

Basic Usage

import org.nd4j.parameterserver.client.ParameterServerClient;
import org.nd4j.linalg.api.ndarray.INDArray;
import io.aeron.Aeron;

// Build a parameter server client
ParameterServerClient client = ParameterServerClient.builder()
    .aeron(aeronInstance)
    .ndarrayRetrieveUrl("aeron:udp?endpoint=localhost:40323")
    .ndarraySendUrl("aeron:udp?endpoint=localhost:40324")
    .subscriberHost("localhost")
    .masterStatusHost("localhost")
    .masterStatusPort(33000)
    .subscriberPort(40625)
    .subscriberStream(12)
    .build();

// Push model parameters to the server
INDArray modelParameters = model.params();
client.pushNDArray(modelParameters);

Architecture

The ND4J Parameter Server Client operates within a distributed training architecture:

  • Client: Manages parameter communication with the parameter server
  • Parameter Server: Centralized component for parameter storage and aggregation
  • Aeron Transport: High-performance messaging layer for low-latency communication
  • INDArray Integration: Direct support for ND4J's n-dimensional array format

The client uses a builder pattern for configuration and integrates seamlessly with DeepLearning4J training workflows, particularly in distributed training scenarios using ParallelWrapper.

Capabilities

Parameter Server Client

Core client functionality for communicating with distributed parameter servers, supporting high-performance parameter synchronization across multiple training nodes.

public class ParameterServerClient {
    public static Builder builder();
    public void pushNDArray(INDArray array);
}

Parameter Synchronization

Sends model parameters to the parameter server for distributed training coordination.

/**
 * Push an NDArray containing model parameters to the parameter server
 * @param array - The INDArray containing parameters to synchronize
 */
public void pushNDArray(INDArray array);

Usage Example:

// After local training step, push updated parameters
INDArray updatedParams = neuralNetwork.params();
parameterServerClient.pushNDArray(updatedParams);

Client Configuration

Builder pattern for configuring the parameter server client with network endpoints and transport settings.

public static class Builder {
    /**
     * Set the Aeron messaging transport instance
     * @param aeron - Aeron instance for high-performance messaging
     * @return Builder instance for method chaining
     */
    public Builder aeron(Aeron aeron);
    
    /**
     * Set the URL for retrieving NDArrays from the parameter server
     * @param url - Aeron URL for parameter retrieval
     * @return Builder instance for method chaining
     */
    public Builder ndarrayRetrieveUrl(String url);
    
    /**
     * Set the URL for sending NDArrays to the parameter server
     * @param url - Aeron URL for parameter sending
     * @return Builder instance for method chaining
     */
    public Builder ndarraySendUrl(String url);
    
    /**
     * Set the subscriber host address
     * @param host - Host address for subscriber connection
     * @return Builder instance for method chaining
     */
    public Builder subscriberHost(String host);
    
    /**
     * Set the master status server host
     * @param host - Host address for status server
     * @return Builder instance for method chaining
     */
    public Builder masterStatusHost(String host);
    
    /**
     * Set the master status server port
     * @param port - Port number for status server
     * @return Builder instance for method chaining
     */
    public Builder masterStatusPort(int port);
    
    /**
     * Set the subscriber port
     * @param port - Port number for subscriber connection
     * @return Builder instance for method chaining
     */
    public Builder subscriberPort(int port);
    
    /**
     * Set the subscriber stream identifier
     * @param stream - Stream identifier for subscriber
     * @return Builder instance for method chaining
     */
    public Builder subscriberStream(int stream);
    
    /**
     * Build and return the configured ParameterServerClient
     * @return Configured ParameterServerClient instance
     */
    public ParameterServerClient build();
}

Configuration Example:

ParameterServerClient client = ParameterServerClient.builder()
    .aeron(mediaDriver.getAeron())
    .ndarrayRetrieveUrl("aeron:udp?endpoint=localhost:40323")
    .ndarraySendUrl("aeron:udp?endpoint=localhost:40324") 
    .subscriberHost("localhost")
    .masterStatusHost("localhost")
    .masterStatusPort(33000)
    .subscriberPort(40625)
    .subscriberStream(12)
    .build();

Types

/**
 * Builder class for configuring ParameterServerClient instances
 */
public static class Builder {
    // Builder methods as documented above
}

/**
 * ND4J's core n-dimensional array interface for parameter data
 * From org.nd4j.linalg.api.ndarray package
 */
interface INDArray {
    // Core n-dimensional array operations
    // Full definition available in ND4J documentation
}

/**
 * Aeron high-performance messaging transport
 * From io.aeron package  
 */
class Aeron {
    // High-performance messaging transport implementation
    // Full definition available in Aeron documentation
}

Integration with DeepLearning4J

The ParameterServerClient integrates with DeepLearning4J's parallel training infrastructure:

// Used within custom trainer implementations
public class ParameterServerTrainer extends DefaultTrainer {
    private ParameterServerClient parameterServerClient;
    
    @Override
    public void feedDataSet(DataSet dataSet, long time) {
        // Perform local training
        model.fit(dataSet);
        
        // Synchronize parameters
        parameterServerClient.pushNDArray(model.params());
    }
}

// Factory for creating parameter server trainers
ParameterServerTrainerContext context = new ParameterServerTrainerContext();
ParallelWrapper wrapper = new ParallelWrapper.Builder(model)
    .trainerFactory(context)
    .workers(numWorkers)
    .build();

Dependencies

The client requires these key dependencies:

  • Aeron: High-performance messaging transport (io.aeron:aeron-all)
  • ND4J Core: N-dimensional array library (org.nd4j:nd4j-api)
  • Parameter Server Node: Server-side components (org.nd4j:nd4j-parameter-server-node)