Skip to content

Commit

Permalink
Merge pull request #23 from PRL-PRG/server-rpc
Browse files Browse the repository at this point in the history
gRPC, caching and RDS improvements
  • Loading branch information
programLyrique authored Nov 21, 2024
2 parents 8a065a5 + c9e2d3a commit dd12fa0
Show file tree
Hide file tree
Showing 95 changed files with 21,752 additions and 12,317 deletions.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ RUN apt install -y \
xvfb \
gdb \
protobuf-compiler \
protobuf-compiler protobuf-compiler-grpc \
bear \
libzmq3-dev \
rr
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
### R ###
.RData
.Rhistory
external/R/doc/manual/*.html
external/R/doc/NEWS.pdf
..Rcheck

### C ###
Expand Down
9 changes: 0 additions & 9 deletions .idea/code.iml

This file was deleted.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

Binary file removed .jqwik-database
Binary file not shown.
76 changes: 75 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
{
"java.compile.nullAnalysis.mode": "disabled"
"java.compile.nullAnalysis.mode": "disabled",
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"format": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"shared_mutex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"typeinfo": "cpp",
"variant": "cpp",
"text_encoding": "cpp",
"expected": "cpp"
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ If the dev container is too slow, you can also setup on the host machine. To do
- **Solution:** ensure you have a Java 22 JDK installed, then run `JAVA_HOME=<path to JDK 22> mvn …`
- e.g. if using IntelliJ on macOS, openJDK 22, set `JAVA_HOME=~/Library/Java/JavaVirtualMachines/openjdk-22/Contents/Home`
- In the devcontainer, `JAVA_HOME=/usr/lib/jvm/jdk`
- **Problem:** some R symbols are not visible when JIT-compiling.
- **Solution:** make sure that `external/R` is up-to-date with `git submodule update --init --recursive` and check if it is the right branch, `RSH-4-3-2`.

If you have a different issue than the above, [report it on GitHub](https://github.com/PRL-PRG/r-compile-server/issues/new/choose).

Expand Down
5 changes: 0 additions & 5 deletions client/protocol/Makefile

This file was deleted.

43 changes: 0 additions & 43 deletions client/protocol/protocol.proto

This file was deleted.

2 changes: 2 additions & 0 deletions client/rsh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ benchmark:
fi; \
done

test6:
$(LLVM_R) -f test6.R
1 change: 1 addition & 0 deletions client/rsh/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export(rsh_cmpfun)
export(rsh_compile)
export(init_client)
export(rsh_jit_disable)
export(rsh_jit_enable)
export(is_compiled)
Expand Down
26 changes: 26 additions & 0 deletions client/rsh/R/rsh.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NULL
# save the original compiler::cmpfun
.gnur_cmpfun <- compiler::cmpfun


# Because of the ORC JIT we need all the native symbols registered globally
# (as RTLD_GLOBAL) so the ORC linker can find them. Unfortunatelly, R does
# not provide a way to instruct the namespace loader to load pass the
Expand All @@ -31,6 +32,19 @@ NULL
)

.Call(C_initialize)

# for the client, so that it is not GC-ed
env[[".rsh_client"]] <- init_client("0.0.0.0", 8980L)
}

#' Initialize the Rsh client
#'
#' @param address IP address of the server
#' @param port port of the server
#' @export
init_client <- function(address="0.0.0.0", port=8980L) {
.rsh_client <- .Call(C_init_client, address, port, installed.packages()[,1])
.rsh_client
}

#' Activate the Rsh JIT
Expand Down Expand Up @@ -71,6 +85,10 @@ rsh_compile <- function(f, options) {
options$inplace <- TRUE
}

if(is.null(options$tier)) {
options$tier <- "optimized"
}

invisible(.Call(C_compile, f, options))
}

Expand Down Expand Up @@ -118,3 +136,11 @@ rsh_override_cmpfun <- function(f) {
lockBinding("cmpfun", compiler_ns)
}

#' Get the total size of the messages sent
#' and received by the server, in bytes
#' @return integer vector of size 2, the first element is the total size of requests,
#' and the second element is the total size of responses
#' @export
rsh_total_size <- function() {
.Call(C_get_total_size)
}
Loading

0 comments on commit dd12fa0

Please sign in to comment.