Skip to content

Commit

Permalink
working run-cu
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed Aug 26, 2024
1 parent 71ea5c8 commit ca86f9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/cuda/evaluator/interactions.cuh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef evaluator_interactions_cuh_INCLUDED
#define evaluator_interactions_cuh_INCLUDED

#include "alloc.cuh"
#include "numb.cuh"
#include "structs/rbag.cuh"
#include "structs/gnet.cuh"
#include "../alloc.cuh"
#include "../numb.cuh"
#include "../structs/rbag.cuh"
#include "../structs/gnet.cuh"

// Linking
// -------
Expand Down
5 changes: 4 additions & 1 deletion src/cuda/hvm.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
//COMPILED_BOOK_BUF//
///COMPILED_INTERACT_CALL///

#ifdef IO
void do_run_io(GNet* gnet, Book* book, Port port);
#endif

// Normalize the root net in book_buffer and print the result.
extern "C" void hvm_cu(u32* book_buffer) {
// Loads the Book
Expand All @@ -36,7 +40,6 @@ extern "C" void hvm_cu(u32* book_buffer) {
gnet_boot_redex(gnet, new_pair(new_port(REF, 0), ROOT));

#ifdef IO
void do_run_io(GNet* gnet, Book* book, Port port);
do_run_io(gnet, book, ROOT);
#else
gnet_normalize(gnet);
Expand Down
4 changes: 2 additions & 2 deletions src/cuda/run.cu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "hvm.cuh"
#include <dlfcn.h>
#include <errno.h>
#include <stdio.h>
#include "hvm.cu"

// Readback: λ-Encoded Ctr
struct Ctr {
Expand Down Expand Up @@ -823,7 +823,7 @@ Port io_dl_call(GNet* gnet, Port argm) {
// Closes a loaded dylib, reclaiming the handle.
//
// Returns: Result<*, IOError<String>>
Port io_dl_close(GNet* gnet, Book* book, Port argm) {
Port io_dl_close(GNet* gnet, Port argm) {
void* dl = readback_dylib(argm);
if (dl == NULL) {
fprintf(stderr, "io_dl_close: invalid handle\n");
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn main() {
//let hvm_c = hvm_c.replace("#define INTERPRETED", "#define COMPILED");

// Generates the Cuda file
let hvm_cu = include_str!("cuda/hvm.cu");
let hvm_cu = include_str!("cuda/main.cu");
let hvm_cu = format!("#define IO\n\n{hvm_cu}");
let hvm_cu = hvm_cu.replace("//COMPILED_BOOK_BUF//", &bookb);
let hvm_cu = hvm_cu.replace("#define WITHOUT_MAIN", "#define WITH_MAIN");
Expand Down

0 comments on commit ca86f9a

Please sign in to comment.