I got a “RuntimeError: [llvm_context.cpp:taichi::lang::TaichiLLVMContext::get_data_type@98] Not supported.” error when running the following code. The code copies the submatrix of a tensor to another tensor.
The funny thing is that if I run the code ONLY with the line 59 - 67 (the lines currently commented out) or the line 38 - 57, I won’t get this error, and the results for those loops are correct. However, if I run the code with those lines together, I will get the error.
What could go wrong here? Thank you for your help.
import taichi as ti
import numpy as np
#ti.init(debug = True, arch = ti.gpu)
ti.init(arch = ti.gpu)
# simulation parameters
n_no_x = 5 #no. of nodes in x direction
n_no_y = 2 #no. of nodes in y direction
n_no = n_no_x * n_no_y
n_no_active = (n_no_x - 1) * n_no_y #excluding Dirichlet nodes
K = ti.var(dt = ti.f32, shape = (2 * n_no, 2 * n_no)) #stiffness matrix
Kc = ti.var(dt = ti.f32, shape = (2 * n_no_active, 2 * n_no_active)) #condensed stiffness matrix
dirichletLength = 2 * n_no_y
dirichletBC = ti.var(dt = ti.i32, shape = dirichletLength) #Dirichlet nodes
@ti.kernel
def init():
# fill in the connectivity matrix, the initial position and assemble the stiffness matrix
for i in range(n_no_y):
dirichletBC[2 * i] = 2 * n_no_x * i
dirichletBC[2 * i + 1] = 2 * n_no_x * i + 1
for i, j in Kc:
Kc[i, j] = 0.0
for i, j in K:
K[i, j] = 0.0
# The lines below: running either part is fine. Running both parts produces an error.
for i in range(dirichletBC[0]):
print(i)
for j in range(dirichletBC[0]):
Kc[i, j] = K[i, j]
for jj in range(1, dirichletLength):
for j in range(dirichletBC[jj - 1] + 1, dirichletBC[jj]):
Kc[i, j - jj] = K[i, j]
for j in range(dirichletBC[dirichletLength - 1] + 1, 2 * n_no):
Kc[i, j - dirichletLength] = K[i, j]
for ii in range(1, dirichletLength):
for i in range(dirichletBC[ii - 1] + 1, dirichletBC[ii]):
print(i)
for j in range(dirichletBC[0]):
Kc[i - ii, j] = K[i, j]
for jj in range(1, dirichletLength):
for j in range(dirichletBC[jj - 1] + 1, dirichletBC[jj]):
Kc[i - ii, j - jj] = K[i, j]
for j in range(dirichletBC[dirichletLength - 1] + 1, 2 * n_no):
Kc[i - ii, j - dirichletLength] = K[i, j]
'''
for i in range(dirichletBC[dirichletLength - 1] + 1, 2 * n_no):
print(i)
for j in range(dirichletBC[0]):
Kc[i - dirichletLength, j] = K[i, j]
for jj in range(1, dirichletLength):
for j in range(dirichletBC[jj - 1] + 1, dirichletBC[jj]):
Kc[i - dirichletLength, j - jj] = K[i, j]
for j in range(dirichletBC[dirichletLength - 1] + 1, 2 * n_no):
Kc[i - dirichletLength, j - dirichletLength] = K[i, j]
'''
#print(K[2, 2])
init()