Skip to content

Commit

Permalink
chore: remove debug printS
Browse files Browse the repository at this point in the history
  • Loading branch information
polvalente committed Sep 9, 2024
1 parent b4a215a commit 1fa784d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion exla/c_src/exla/exla.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,6 @@ ERL_NIF_TERM create_buffer_from_device_pointer(ErlNifEnv* env, int argc, const E

EXLA_ASSIGN_OR_RETURN_NIF(xla::PjRtDevice * device, (*client)->client()->LookupDevice(xla::PjRtGlobalDeviceId(device_id)), env);

std::function<void()> on_delete_callback = []() {};
EXLA_ASSIGN_OR_RETURN_NIF(std::unique_ptr<xla::PjRtBuffer> buffer, (*client)->client()->CreateViewOfDeviceBuffer(ptr, shape, device, on_delete_callback), env);

exla::ExlaBuffer* exla_buffer = new exla::ExlaBuffer(std::move(buffer));
Expand Down
3 changes: 0 additions & 3 deletions exla/c_src/exla/ipc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ int get_ipc_handle(const char* memname, size_t memsize) {

// Function to map the shared memory in this process
void* open_ipc_handle(int fd, size_t memsize) {
std::cout << "fd: " << fd << std::endl;
std::cout << "memsize: " << memsize << std::endl;
void* ptr = mmap(NULL, memsize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
perror("mmap");
return nullptr;
}
std::cout << "ptr: " << ptr << std::endl;
return ptr;
}

Expand Down
4 changes: 1 addition & 3 deletions exla/lib/exla/backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,9 @@ defmodule EXLA.Backend do

case EXLA.NIF.get_buffer_device_pointer(client.ref, buffer.ref, mode) do
{:ok, result} ->
dbg(result)

handle =
case {result, mode} do
{{ptr, size}, :local} when is_integer(ptr) ->
{{ptr, _size}, :local} when is_integer(ptr) ->
# pointer is an integer here
ptr

Expand Down
4 changes: 2 additions & 2 deletions exla/test/exla/device_memory_sharing_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule EXLA.DeviceMemorySharingTest do

assert {:ok, t2} =
Nx.from_pointer(
{EXLA.Backend, client_name: unquote(client_name)},
{EXLA.Backend, client: unquote(client_name)},
pointer,
t1.type,
t1.shape
Expand All @@ -30,7 +30,7 @@ defmodule EXLA.DeviceMemorySharingTest do
test "ipc handles don't crash the runtime when :local mode is selected" do
assert {:error, ~c"Invalid pointer size for selected mode."} ==
Nx.from_pointer(
{EXLA.Backend, client_name: :cuda},
{EXLA.Backend, client: :cuda},
Enum.to_list(0..63),
{:f, 32},
{1},
Expand Down

0 comments on commit 1fa784d

Please sign in to comment.