Skip to content

C contiguous stride not working for the example #177

@Jinghong-Zhang

Description

@Jinghong-Zhang

Hi cuquantum team, I am trying to play around with the example python/samples/cutensornet/tensornet_example.py, and I wonder if I can use the C-contiguous arrays for the optimization of contraction paths and also the actual contraction. To do this, I just replaced
strides_in = (0,0,0,0) with strides_in = (A_d.strides, B_d.strides, C_d.strides, D_d.strides) and also

desc_net = cutn.create_network_descriptor(handle,
    num_inputs, num_modes_in, extents_in, strides_in, modes_in, qualifiers_in,  # inputs
    nmode_R, extent_R, 0, modes_R,  # output
    data_type, compute_type)

with

desc_net = cutn.create_network_descriptor(handle,
    num_inputs, num_modes_in, extents_in, strides_in, modes_in, qualifiers_in,  # inputs
    nmode_R, extent_R, R_d.strides, modes_R,  # output
    # nmode_R, extent_R, 0, modes_R,  # output
    data_type, compute_type)

and didn't change any other thing. However, the output is:

cuTensorNet-vers: 20600
===== device info ======
GPU-local-id: 0
GPU-name: NVIDIA A100-SXM4-40GB MIG 3g.20gb
GPU-clock: 1410000
GPU-memoryClock: 1215000
GPU-nSM: 42
GPU-major: 8
GPU-minor: 0
========================
Include headers and define data types.
Define network, modes, and extents.
(262144,)
((4,), (4,), (4,), (4,))
Initialize the cuTensorNet library and create a network descriptor.
Traceback (most recent call last):
  File "pathtotest/cutensornet_test/stride_modification.py", line 125, in <module>
    cutn.contraction_optimize(handle, desc_net, optimizer_config, workspace_limit, optimizer_info)
  File "cuquantum/cutensornet/cutensornet.pyx", line 754, in cuquantum.cutensornet.cutensornet.contraction_optimize
  File "cuquantum/cutensornet/cutensornet.pyx", line 768, in cuquantum.cutensornet.cutensornet.contraction_optimize
  File "cuquantum/cutensornet/cutensornet.pyx", line 277, in cuquantum.cutensornet.cutensornet.check_status
cuquantum.cutensornet.cutensornet.cuTensorNetError: ALL_HYPER_SAMPLES_FAILED (24): CUTENSORNET_STATUS_ALL_HYPER_SAMPLES_FAILED

Could you tell me what happened here or how can I use C-contiguous arrays in this example instead of F-contiguous? Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions