k-wave-python icon indicating copy to clipboard operation
k-wave-python copied to clipboard

[BUG] Issue executing CPU binary

Open waltsims opened this issue 1 year ago • 0 comments

Describe the bug

I have encountered an execution error likely related to the cross-compilation compatibility of the CPU binaries. When running a simple example with:

 execution_options = SimulationExecutionOptions(is_gpu_simulation=False)

I get the following error:

/bin/sh: 1: /home/wsimson/git/k-wave-python/kwave/bin/linux/kspaceFirstOrder-OMP: Exec format error

To Reproduce

Here is the full example code:


import numpy as np
from kwave.data import Vector
from kwave.kgrid import kWaveGrid
from kwave.kmedium import kWaveMedium
from kwave.ksensor import kSensor
from kwave.ksource import kSource
from kwave.kspaceFirstOrder2D import kspaceFirstOrder2DC
from kwave.options.simulation_execution_options import SimulationExecutionOptions
from kwave.options.simulation_options import SimulationOptions
from kwave.utils.conversion import cart2grid
from kwave.utils.kwave_array import kWaveArray
from kwave.utils.mapgen import make_cart_circle, make_disc
from kwave.utils.signals import reorder_binary_sensor_data

phantom_path = 'phantom_data.mat'
density_map_path = '../density_map.mat'

density_map = np.ones((512,512)) * 1000
phantom = np.zeros((512, 512))



# grid
PMLSize = Vector([20, 20])
grid_dsize = Vector([1e-4, 1e-4])
grid_pixel = Vector([512, 512])
kgrid = kWaveGrid(grid_pixel, grid_dsize)

# medium
medium = kWaveMedium(
    sound_speed=1.5*density_map,
    density=density_map,
    alpha_coeff=0.75,
    alpha_power=1.5,
    BonA=6
)
kgrid.makeTime(medium.sound_speed)

# sensor
sensor = kSensor()
sensor_mask = np.zeros(grid_pixel)
sensor_radius = 200
sensor_angle = 2*np.pi
sensor_pos = grid_dsize / 2
sensor_points = 100
sensor_mask_idx = make_cart_circle(
    radius=sensor_radius,
    num_points=sensor_points,
    arc_angle=sensor_angle,
).astype(np.int16)
for x, y in sensor_mask_idx.T:
    sensor_mask[x, y] = 1
sensor.mask = sensor_mask

# source
source = kSource()
x = 250
y = 300
source_radius = 5
disc = make_disc(
    grid_size=grid_pixel,
    center=Vector([x, y]),
    radius=source_radius
)

source.p0 = phantom + disc

# simulation
simulation_options = SimulationOptions(
    pml_size=PMLSize,
    pml_inside=False,
    save_to_disk=True
)

execution_options = SimulationExecutionOptions(is_gpu_simulation=False)

sensor_data = kspaceFirstOrder2D(
    kgrid=kgrid,
    source=source,
    sensor=sensor,
    medium=medium,
    simulation_options=simulation_options,
    execution_options=execution_options)

Desktop (please complete the following information):

  • OS: Linux 5.15.0-88-generic
  • Version: k-wave-python commit e057f8747bb3dbc62a9d83cbf7d386ac514a82f4
  • Python Version: 3.8.10 Additional context lscpu output:

Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Byte Order:                         Little Endian
Address sizes:                      46 bits physical, 48 bits virtual
CPU(s):                             20
On-line CPU(s) list:                0-19
Thread(s) per core:                 1
Core(s) per socket:                 12
Socket(s):                          1
NUMA node(s):                       1
Vendor ID:                          GenuineIntel
CPU family:                         6
Model:                              151
Model name:                         12th Gen Intel(R) Core(TM) i7-12700K

waltsims avatar Jan 15 '24 03:01 waltsims