8000 Update on "Initial support for sparse complex tensors constructors … · pytorch/pytorch@ca36928 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca36928

Browse files
committed
Update on "Initial support for sparse complex tensors constructors for CPU/CUDA"
Currently, sparse tensors only support real floating point tensors. Complex support is added in this PR for CPU/CUDA. - [x] add complex support (torch.cfloat and torch.cdouble) to torch.sparse_coo_tensor constructors - [x] add complex support to coalesce function - [x] add complex support to to_dense function - [x] add complex support to to_sparse function - [x] add complex support to sparse_add function - [x] add unit tests Note: This PR contains only complex support for torch.sparse_coo_tensor fordward function and the related ops used with this function (coalesce, to_dense, to_sparse, and sparse_add). The following PRs in ghstack should cover other sparse operations to have a more complex sparse support, specifically related with the use of specific APIs for accelerated linear algebra. Note: Before using ghstack the original PR was #50984 [ghstack-poisoned]
2 parents e6891b2 + 07878ad commit ca36928

File tree

381 files changed

+10972
-5699
lines changed
  • test
  • torch
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    381 files changed

    +10972
    -5699
    lines changed

    .circleci/docker/README.md

    Lines changed: 10 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -19,3 +19,13 @@ Docker builds are now defined with `.circleci/cimodel/data/simple/docker_definit
    1919
    * `build.sh` -- dispatch script to launch all builds
    2020
    * `common` -- scripts used to execute individual Docker build stages
    2121
    * `ubuntu-cuda` -- Dockerfile for Ubuntu image with CUDA support for nvidia-docker
    22+
    23+
    ## Usage
    24+
    25+
    ```bash
    26+
    # Build a specific image
    27+
    ./build.sh pytorch-linux-bionic-py3.8-gcc9 -t myimage:latest
    28+
    29+
    # Set flags (see build.sh) and build image
    30+
    sudo bash -c 'BREAKPAD=1 ./build.sh pytorch-linux-bionic-py3.8-gcc9 -t myimage:latest
    31+
    ```

    .circleci/docker/build.sh

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -197,6 +197,7 @@ case "$image" in
    197197
    PROTOBUF=yes
    198198
    DB=yes
    199199
    VISION=yes
    200+
    BREAKPAD=yes
    200201
    ;;
    201202
    pytorch-linux-bionic-cuda10.2-cudnn7-py3.6-clang9)
    202203
    CUDA_VERSION=10.2
    @@ -316,6 +317,7 @@ docker build \
    316317
    --build-arg "GCC_VERSION=${GCC_VERSION}" \
    317318
    --build-arg "CUDA_VERSION=${CUDA_VERSION}" \
    318319
    --build-arg "CUDNN_VERSION=${CUDNN_VERSION}" \
    320+
    --build-arg "BREAKPAD=${BREAKPAD}" \
    319321
    --build-arg "ANDROID=${ANDROID}" \
    320322
    --build-arg "ANDROID_NDK=${ANDROID_NDK_VERSION}" \
    321323
    --build-arg "GRADLE_VERSION=${GRADLE_VERSION}" \
    Lines changed: 13 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,13 @@
    1+
    #!/bin/bash
    2+
    3+
    set -ex
    4+
    5+
    git clone https://github.com/google/breakpad.git
    6+
    cd breakpad
    7+
    8+
    git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss
    9+
    ./configure
    10+
    make
    11+
    make install
    12+
    cd ..
    13+
    rm -rf breakpad

    .circleci/docker/common/install_conda.sh

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -113,7 +113,7 @@ if [ -n "$ANACONDA_PYTHON_VERSION" ]; then
    113113
    boto3==1.16.34 \
    114114
    coverage \
    115115
    hypothesis==4.53.2 \
    116-
    mypy==0.770 \
    116+
    mypy==0.812 \
    117117
    tb-nightly
    118118

    119119
    # Update scikit-learn to a python-3.8 compatible version

    .circleci/docker/ubuntu/Dockerfile

    Lines changed: 7 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -82,6 +82,13 @@ RUN rm AndroidManifest.xml
    8282
    RUN rm build.gradle
    8383
    ENV INSTALLED_ANDROID ${ANDROID}
    8484

    85+
    # (optional) Install breakpad
    86+
    ARG BREAKPAD
    87+
    ADD ./common/install_breakpad.sh install_breakpad.sh
    88+
    RUN if [ -n "${BREAKPAD}" ]; then bash ./install_breakpad.sh; fi
    89+
    RUN rm install_breakpad.sh
    90+
    ENV INSTALLED_BREAKPAD ${BREAKPAD}
    91+
    8592
    # (optional) Install Vulkan SDK
    8693
    ARG VULKAN_SDK_VERSION
    8794
    ADD ./common/install_vulkan_sdk.sh install_vulkan_sdk.sh

    .flake8

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -4,7 +4,7 @@ max-line-length = 120
    44
    # C408 ignored because we like the dict keyword argument syntax
    55
    # E501 is not flexible enough, we're using B950 instead
    66
    ignore =
    7-
    E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
    7+
    E203,E305,E402,E501,E721,E741,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
    88
    # shebang has extra meaning in fbcode lints, so I think it's not worth trying
    99
    # to line this up with executable bit
    1010
    EXE001,

    .github/scale-config.yml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -23,9 +23,9 @@ runner_types:
    2323
    instance_type: c5.2xlarge
    2424
    os: linux
    2525
    max_available: 200
    26-
    disk_size: 100
    26+
    disk_size: 150
    2727
    linux.8xlarge.nvidia.gpu:
    2828
    instance_type: g3.8xlarge
    2929
    os: linux
    3030
    max_available: 50
    31-
    disk_size: 100
    31+
    disk_size: 150

    .github/workflows/lint.yml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -30,7 +30,7 @@ jobs:
    3030
    with open('.github/workflows/cancel_redundant_workflows.yml') as f:
    3131
    data = yaml.safe_load(f)
    3232
    workflows_to_cancel = data[True]['workflow_run']['workflows']
    33-
    assert workflows.sort() == workflows_to_cancel.sort()
    33+
    assert sorted(workflows) == sorted(workflows_to_cancel)
    3434
    shell: python
    3535
    - name: ShellCheck
    3636
    # https://github.com/koalaman/shellcheck/tree/v0.7.1#installing-a-pre-compiled-binary
    @@ -293,7 +293,7 @@ jobs:
    293293
    run: |
    294294
    set -eux
    295295
    pip install -r requirements.txt
    296-
    pip install mypy==0.770
    296+
    pip install mypy==0.812
    297297
    - name: Run autogen
    298298
    run: |
    299299
    set -eux

    .github/workflows/test_tools.yml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -25,6 +25,6 @@ jobs:
    2525
    run: |
    2626
    set -eux
    2727
    pip install -r requirements.txt
    28-
    pip install boto3==1.16.34 mypy==0.770
    28+
    pip install boto3==1.16.34 mypy==0.812
    2929
    - name: Run tests
    3030
    run: python -m unittest discover -vs tools/test -p 'test_*.py'

    .jenkins/pytorch/multigpu-test.sh

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -22,5 +22,6 @@ time python test/run_test.py --verbose -i distributed/test_jit_c10d
    2222
    time python test/run_test.py --verbose -i distributed/test_distributed_fork
    2323
    time python test/run_test.py --verbose -i distributed/test_c10d
    2424
    time python test/run_test.py --verbose -i distributed/test_c10d_spawn
    25-
    time python test/run_test.py --verbose -i distributed/rpc/test_tensorpipe_agent
    25+
    time python test/run_test.py --verbose -i distributed/rpc/cuda/test_process_group_agent
    26+
    time python test/run_test.py --verbose -i distributed/rpc/cuda/test_tensorpipe_agent
    2627
    assert_git_not_dirty

    0 commit comments

    Comments
     (0)
    0