Skip to content

torch.dot() produce wrong results (ubuntu 24.04) #398

@husisy

Description

@husisy

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

related issue #180 is on macOS, and this one is on ubuntu-24.04.

minimum working example to reproduce

step 1: create a new environment (I tried cuda126/cuda128/cpu, all three cases can reproduce the issue)

micromamba create -y -n env126
micromamba install -y -n env126 -c conda-forge cuda-version=12.6 numpy pytorch

micromamba create -y -n env128
micromamba install -y -n env128 -c conda-forge cuda-version=12.8 numpy pytorch

micromamba create -y -n envcpu
CONDA_OVERRIDE_CUDA= micromamba install -y -n envcpu -c conda-forge numpy pytorch

micromamba activate <envname> #replace <envname> with the env126/env128/envcpu

step 2: run python scripts

#draft00.py
import numpy as np
import torch
x = torch.tensor([2], dtype=torch.complex128)
print(torch.dot(x, x))
$ python draft00.py
tensor(0.+0.j, dtype=torch.complex128)
# it should be "tensor(4.+0.j, dtype=torch.complex128)"

Installed packages

List of packages in environment: "/home/zhangc/micromamba/envs/envcpu"

  Name               Version     Build                       Channel    
──────────────────────────────────────────────────────────────────────────
  _openmp_mutex      4.5         3_kmp_llvm                  conda-forge
  bzip2              1.0.8       h4bc722e_7                  conda-forge
  ca-certificates    2025.6.15   hbd8a1cb_0                  conda-forge
  cpython            3.13.5      py313hd8ed1ab_102           conda-forge
  filelock           3.18.0      pyhd8ed1ab_0                conda-forge
  fsspec             2025.5.1    pyhd8ed1ab_0                conda-forge
  gmp                6.3.0       hac33072_2                  conda-forge
  gmpy2              2.2.1       py313h11186cd_0             conda-forge
  icu                75.1        he02047a_0                  conda-forge
  jinja2             3.1.6       pyhd8ed1ab_0                conda-forge
  ld_impl_linux-64   2.44        h1423503_0                  conda-forge
  libabseil          20250127.1  cxx17_hbbce691_0            conda-forge
  libblas            3.9.0       32_hfdb39a5_mkl             conda-forge
  libcblas           3.9.0       32_h372d94f_mkl             conda-forge
  libexpat           2.7.0       h5888daf_0                  conda-forge
  libffi             3.4.6       h2dba641_1                  conda-forge
  libgcc             15.1.0      h767d61c_3                  conda-forge
  libgcc-ng          15.1.0      h69a702a_3                  conda-forge
  libhwloc           2.11.2      default_h0d58e46_1001       conda-forge
  libiconv           1.18        h4ce23a2_1                  conda-forge
  liblapack          3.9.0       32_hc41d3b0_mkl             conda-forge
  liblzma            5.8.1       hb9d3cd8_2                  conda-forge
  libmpdec           4.0.0       hb9d3cd8_0                  conda-forge
  libprotobuf        5.29.3      h501fc15_1                  conda-forge
  libsqlite          3.50.2      h6cd9bfd_0                  conda-forge
  libstdcxx          15.1.0      h8f9b012_3                  conda-forge
  libstdcxx-ng       15.1.0      h4852527_3                  conda-forge
  libtorch           2.7.1       cpu_mkl_h783a78b_101        conda-forge
  libuuid            2.38.1      h0b41bf4_0                  conda-forge
  libuv              1.51.0      hb9d3cd8_0                  conda-forge
  libxml2            2.13.8      h4bc477f_0                  conda-forge
  libzlib            1.3.1       hb9d3cd8_2                  conda-forge
  llvm-openmp        20.1.7      h024ca30_0                  conda-forge
  markupsafe         3.0.2       py313h8060acc_1             conda-forge
  mkl                2024.2.2    ha957f24_16                 conda-forge
  mpc                1.3.1       h24ddda3_1                  conda-forge
  mpfr               4.2.1       h90cbb55_3                  conda-forge
  mpmath             1.3.0       pyhd8ed1ab_1                conda-forge
  ncurses            6.5         h2d0b736_3                  conda-forge
  networkx           3.5         pyhe01879c_0                conda-forge
  numpy              2.3.1       py313h17eae1a_0             conda-forge
  openssl            3.5.1       h7b32b05_0                  conda-forge
  optree             0.16.0      py313h33d0bda_0             conda-forge
  pip                25.1.1      pyh145f28c_0                conda-forge
  pybind11           2.13.6      pyhc790b64_3                conda-forge
  pybind11-global    2.13.6      pyh217bc35_3                conda-forge
  python             3.13.5      hec9711d_102_cp313          conda-forge
  python_abi         3.13        7_cp313                     conda-forge
  pytorch            2.7.1       cpu_mkl_py313_he78a34b_101  conda-forge
  readline           8.2         h8c095d6_2                  conda-forge
  setuptools         80.9.0      pyhff2d567_0                conda-forge
  sleef              3.8         h1b44611_0                  conda-forge
  sympy              1.14.0      pyh2585a3b_105              conda-forge
  tbb                2021.13.0   hceb3a55_1                  conda-forge
  tk                 8.6.13      noxft_hd72426e_102          conda-forge
  typing-extensions  4.14.1      h4440ef1_0                  conda-forge
  typing_extensions  4.14.1      pyhe01879c_0                conda-forge
  tzdata             2025b       h78e105d_0                  conda-forge

Environment info

libmamba version : 2.3.0
     micromamba version : 2.3.0
           curl version : libcurl/8.14.1 OpenSSL/3.5.0 zlib/1.3.1 zstd/1.5.7 libssh2/1.11.1 nghttp2/1.64.0
     libarchive version : libarchive 3.8.1 zlib/1.3.1 bz2lib/1.0.8 libzstd/1.5.7 libb2/bundled
       envs directories : /home/zhangc/micromamba/envs
          package cache : /home/zhangc/micromamba/pkgs
                          /home/zhangc/.mamba/pkgs
            environment : envcpu (active)
           env location : /home/zhangc/micromamba/envs/envcpu
      user config files : /home/zhangc/.mambarc
 populated config files : /home/zhangc/.mambarc
                          /home/zhangc/.condarc
       virtual packages : __unix=0=0
                          __linux=6.8.0=0
                          __glibc=2.39=0
                          __archspec=1=x86_64_v3
                          __cuda=12.9=0
               channels : https://mirrors.sustech.edu.cn/anaconda/cloud/conda-forge/linux-64
                          https://mirrors.sustech.edu.cn/anaconda/cloud/conda-forge/noarch
       base environment : /home/zhangc/micromamba
               platform : linux-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions