Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with CPU version #9

Open
RaulPPelaez opened this issue Sep 14, 2022 · 1 comment
Open

Issue with CPU version #9

RaulPPelaez opened this issue Sep 14, 2022 · 1 comment

Comments

@RaulPPelaez
Copy link
Contributor

Calling SetPositions twice makes the solver segfault.

After creating a valid solver using the cpu as device, the second call to SetPositions crashes the code:
For instance:

import numpy as np
from common_interface_wrapper import FCMJoint
device = 'cpu'
domType = 'DPSC'
nP = 2 #Number of particles
has_torque = True # Set to True if angular displacements are needed
viscosity = 0.957e-3
L=128
xmin = -L/2
ymin = -L/2
H = 2
zmin = 0
zmax = H
solver = FCMJoint(device)
solver.Initialize(numberParticles=nP, hydrodynamicRadius=1.0155, kernType=0,
                  domType=domType, has_torque=has_torque,
                  xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
                  viscosity=viscosity, optInd=0, ref=False)
np.random.seed(1234)
xP = np.zeros(3 * nP, dtype = np.double) # Arbitrary xP inside the Z domain
xP[0::3] = np.random.uniform(xmin, xmax, nP)*0 #X
xP[1::3] = np.random.uniform(ymin, ymax, nP)*0 #Y
xP[2::3] = np.random.uniform(zmin, zmax, nP)*0 #Z
xP[3] += 1.000000;
torques = np.random.normal(0, 1, 3 * nP)*0
forces = np.random.normal(0, 1, 3 * nP)*0
solver.SetPositions(xP)
V, T = solver.Mdot(forces, torques)
solver.SetPositions(xP)
print("This is never printed")
@snatesh
Copy link
Member

snatesh commented Sep 15, 2022

I'm unable to reproduce this error. The script is executed completely on several machines I've tried. One thing to try is make sure zmin/zmax are doubles and not integers. I will look more into this and the other issue over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants