@ Override public void aggregate ( Aggregate op , long key ) { int deviceId = Nd4j . getAffinityManager ( ) . getDeviceForCurrentThread ( ) ; if ( opCounter . get ( ) == null ) opCounter . set ( new AtomicLong ( 0 ) ) ; // we enqueue op for specific device here aggregates . get ( deviceId ) . add ( new AggregateDescriptor ( op , key , opCounter . get ( ) . getAndIncrement ( ) ) ) ; }
This method enqueues aggregate op for future invocation . Key value will be used to batch individual ops