deeplearning4j/deeplearning4j

View on GitHub
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java

Summary

Maintainability
D
1 day
Test Coverage

AtomicAllocator has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

public class AtomicAllocator implements Allocator {
    private static final AtomicAllocator INSTANCE = new AtomicAllocator();

    private Configuration configuration;

    File AtomicAllocator.java has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     *  ******************************************************************************
     *  *
     *  *
     *  * This program and the accompanying materials are made available under the

      Method seekUnusedZero has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected synchronized long seekUnusedZero(Long bucketId, Aggressiveness aggressiveness) {
              AtomicLong freeSpace = new AtomicLong(0);
      
              int totalElements = (int) memoryHandler.getAllocatedHostObjects(bucketId);
      
      

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method memcpyDevice has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public void memcpyDevice(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset,
                                   CudaContext context) {

        Method purgeDeviceObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected void purgeDeviceObject(Long threadId, Integer deviceId, Long objectId, AllocationPoint point,
                                             boolean copyback) {

          Method seekUnusedDevice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected long seekUnusedDevice(Long threadId, Integer deviceId, Aggressiveness aggressiveness) {
                  AtomicLong freeSpace = new AtomicLong(0);
          
          
                  //  int initialSize = allocations.size();

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method freeMemory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public void freeMemory(AllocationPoint point) {
                  if (point.getAllocationStatus() == AllocationStatus.DEVICE) {
                      this.getMemoryHandler().getMemoryProvider().free(point);
          
                      if (point.getHostPointer() != null) {

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status