Skip to content

Commit 2cce9a2

Browse files
authored
supply our own zeromq API via Rcpp (mschubert#165)
* basic direct Rcpp interface to library * ignore src object files, pkg archive * add rcpp infra * handle socket types via strings + default args * always poll rw (no async sockets in cmq) * update rcpp bindings on make * req R>=interrupt handling fix * fix polling; no defaults (not working) * remove comments, C++ errors are there+readable * use rcpp attributes for default values * avoid Rf_error (longjmp) * try zmq=4.2.2 * adjust R version dep * add cppzmq header file * revert ext libzmq * add is_trivially_copyable workaround * try explicit xenial * move zmq.hpp to inst * depend on R x.y.0 (check warning) * compile needs more time * flags and serialization * basic binding test * make context threads optional * serialize initMessage if not already
1 parent b1bbb49 commit 2cce9a2

12 files changed

+2377
-5
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ inst/doc
55
vignettes/*.R
66
vignettes/*.md
77
vignettes/.build.timestamp
8+
src/*.o
9+
src/*.so
810
*.swp
11+
*.tar.gz

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: r
22

3+
dist: xenial
4+
35
r:
46
- release
57
- devel
@@ -36,7 +38,7 @@ script:
3638
- R --no-save --no-restore -e "message(clustermq:::qsys_default)" > /dev/null
3739
- ssh localhost 'R --no-save --no-restore -e "message(clustermq:::qsys_default)" > /dev/null'
3840
- make test
39-
- timeout 120 make check
41+
- timeout 240 make check
4042
# - timeout 120 R CMD check --as-cran *.tar.gz
4143

4244
after_failure:

DESCRIPTION

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: clustermq
22
Title: Evaluate Function Calls on HPC Schedulers (LSF, SGE, SLURM, PBS/Torque)
3-
Version: 0.8.8
3+
Version: 0.8.90
44
Authors@R: c(
55
person('Michael', 'Schubert', email='[email protected]',
66
role = c('aut', 'cre', 'cph'),
@@ -15,12 +15,15 @@ Description: Evaluate arbitrary function calls using workers on HPC schedulers
1515
URL: https://github.com/mschubert/clustermq
1616
BugReports: https://github.com/mschubert/clustermq/issues
1717
Depends:
18-
R (>= 3.0.2)
18+
R (>= 3.5.0)
19+
LinkingTo: Rcpp
20+
SystemRequirements: C++11
1921
Imports:
2022
narray,
2123
progress,
2224
purrr,
2325
R6,
26+
Rcpp,
2427
rzmq (>= 0.9.4),
2528
utils
2629
License: Apache License (== 2.0) | file LICENSE
@@ -37,4 +40,4 @@ Suggests:
3740
testthat,
3841
tools
3942
VignetteBuilder: knitr
40-
RoxygenNote: 6.1.1
43+
RoxygenNote: 6.1.1.9000

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.PHONY: all
2-
all: doc vignettes
2+
all: rcpp doc vignettes
33

44
R = R --no-save --no-restore -e
55
BIN = $(abspath $(lastword $(MAKEFILE_LIST))/../tests/bin)
@@ -12,6 +12,10 @@ test:
1212
check:
1313
PATH=$(BIN):$$PATH $(R) "devtools::check()"
1414

15+
.PHONY: rcpp
16+
rcpp:
17+
$(R) "Rcpp::compileAttributes()"
18+
1519
rmd_files=$(wildcard vignettes/*.rmd)
1620
knit_results=$(patsubst vignettes/%.rmd,inst/doc/%.md,$(rmd_files))
1721

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export(Q)
44
export(Q_rows)
55
export(register_dopar_cmq)
66
export(workers)
7+
import(Rcpp)
8+
useDynLib(clustermq)

R/RcppExports.R

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
2+
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3+
4+
initContext <- function(threads = 1L) {
5+
.Call('_clustermq_initContext', PACKAGE = 'clustermq', threads)
6+
}
7+
8+
initSocket <- function(context_, socket_type_) {
9+
.Call('_clustermq_initSocket', PACKAGE = 'clustermq', context_, socket_type_)
10+
}
11+
12+
initMessage <- function(data_) {
13+
.Call('_clustermq_initMessage', PACKAGE = 'clustermq', data_)
14+
}
15+
16+
bindSocket <- function(socket_, address) {
17+
invisible(.Call('_clustermq_bindSocket', PACKAGE = 'clustermq', socket_, address))
18+
}
19+
20+
connectSocket <- function(socket_, address) {
21+
invisible(.Call('_clustermq_connectSocket', PACKAGE = 'clustermq', socket_, address))
22+
}
23+
24+
disconnectSocket <- function(socket_, address) {
25+
invisible(.Call('_clustermq_disconnectSocket', PACKAGE = 'clustermq', socket_, address))
26+
}
27+
28+
pollSocket <- function(sockets_, timeout = -1L) {
29+
.Call('_clustermq_pollSocket', PACKAGE = 'clustermq', sockets_, timeout)
30+
}
31+
32+
receiveSocket <- function(socket_, dont_wait = FALSE, unserialize = TRUE) {
33+
.Call('_clustermq_receiveSocket', PACKAGE = 'clustermq', socket_, dont_wait, unserialize)
34+
}
35+
36+
sendSocket <- function(socket_, data_, dont_wait = FALSE, send_more = FALSE) {
37+
invisible(.Call('_clustermq_sendSocket', PACKAGE = 'clustermq', socket_, data_, dont_wait, send_more))
38+
}
39+

R/clustermq-package.r

+2
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
#'
2525
#' @name clustermq
2626
#' @docType package
27+
#' @useDynLib clustermq
28+
#' @import Rcpp
2729
NULL

0 commit comments

Comments
 (0)