deeplearning4j/deeplearning4j

View on GitHub
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java

Summary

Maintainability
F
1 wk
Test Coverage

CudaDataBufferFactory has 133 methods (exceeds 20 allowed). Consider refactoring.
Open

@Slf4j
public class CudaDataBufferFactory implements DataBufferFactory {
    protected DataBuffer.AllocationMode allocationMode;

    @Override

    File CudaDataBufferFactory.java has 763 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public DataBuffer create(ByteBuffer underlyingBuffer, DataType dataType, long length, long offset) {
              switch (dataType) {
                  case DOUBLE:
                      return new CudaDoubleDataBuffer(underlyingBuffer, dataType, length, offset);

        Method create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public DataBuffer create(DataBuffer underlyingBuffer, long offset, long length) {
                switch (underlyingBuffer.dataType()) {
                    case DOUBLE:
                        return new CudaDoubleDataBuffer(underlyingBuffer, length, offset);

          Method create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public DataBuffer create(DataType dataType, long length, boolean initialize, MemoryWorkspace workspace) {
                  if (workspace == null)
                      return create(dataType, length, initialize);
          
          

            Method create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public DataBuffer create(DataType dataType, long length, boolean initialize) {
                    switch (dataType) {
                        case UINT16:
                            return new CudaUInt16DataBuffer(length, initialize);

              Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Override
                  public DataBuffer create(Pointer pointer, DataType type, long length, Indexer indexer) {
                      switch (type) {
                          case UINT64:
                              return new CudaUInt64DataBuffer(pointer, indexer, length);

                Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public DataBuffer create(Pointer pointer, Pointer specialPointer, DataType type, long length, Indexer indexer) {
                        switch (type) {
                            case UINT64:
                                return new CudaUInt64DataBuffer(pointer, specialPointer, indexer, length);

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

                      public DataBuffer create(Pointer pointer, Pointer specialPointer, DataType type, long length, Indexer indexer) {

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        @Override
                        public DataBuffer create(ByteBuffer underlyingBuffer, DataType dataType, long length, long offset) {
                            switch (dataType) {
                                case DOUBLE:
                                    return new CudaDoubleDataBuffer(underlyingBuffer, dataType, length, offset);
                    nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cpu-backend-common/src/main/java/org/nd4j/linalg/cpu/nativecpu/buffer/DefaultDataBufferFactory.java on lines 251..285

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 251.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        @Override
                        public DataBuffer create(Pointer pointer, DataType type, long length, Indexer indexer) {
                            switch (type) {
                                case UINT64:
                                    return new CudaUInt64DataBuffer(pointer, indexer, length);
                    nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cpu-backend-common/src/main/java/org/nd4j/linalg/cpu/nativecpu/buffer/DefaultDataBufferFactory.java on lines 704..735

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 203.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            switch (dataType) {
                                case UINT16:
                                    return new CudaUInt16DataBuffer(length, initialize, workspace);
                                case UINT32:
                                    return new CudaUInt32DataBuffer(length, initialize, workspace);
                    nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cpu-backend-common/src/main/java/org/nd4j/linalg/cpu/nativecpu/buffer/DefaultDataBufferFactory.java on lines 325..354

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 202.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        @Override
                        public DataBuffer create(DataType dataType, long length, boolean initialize) {
                            switch (dataType) {
                                case UINT16:
                                    return new CudaUInt16DataBuffer(length, initialize);
                    nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cpu-backend-common/src/main/java/org/nd4j/linalg/cpu/nativecpu/buffer/DefaultDataBufferFactory.java on lines 287..321

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 194.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        @Override
                        public DataBuffer.AllocationMode allocationMode() {
                            if (allocationMode == null) {
                                String otherAlloc = System.getProperty("alloc");
                                if (otherAlloc.equals("heap"))
                    nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cpu-backend-common/src/main/java/org/nd4j/linalg/cpu/nativecpu/buffer/DefaultDataBufferFactory.java on lines 48..60

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 83.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    There are no issues that match your filters.

                    Category