Skip to content

Commit

Permalink
Do not set kit.nThread if already set
Browse files Browse the repository at this point in the history
  • Loading branch information
2005m committed Feb 26, 2024
1 parent 444d7f2 commit 0d948ca
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: kit
Type: Package
Title: Data Manipulation Functions Implemented in C
Version: 0.0.15
Date: 2023-10-01
Version: 0.0.16
Date: 2024-03-01
Authors@R: c(person("Morgan", "Jacob", role = c("aut", "cre", "cph"), email = "[email protected]"),
person("Sebastian", "Krantz", role = "ctb"))
Author: Morgan Jacob [aut, cre, cph], Sebastian Krantz [ctb]
Expand Down
8 changes: 4 additions & 4 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
6071edd604dbeb75308cfbedc7790398 *cleanup
d2761d00effd7b096a5bea21bc38742e *configure
f26c0015784f555768de9fd4dbd52191 *DESCRIPTION
771ad7a0ba9d6856cecdc324826a8d09 *inst/NEWS.Rd
63e50ec034f2ae68dc2cac70b943bc5a *DESCRIPTION
06bd5048f6b3775957ec019ae7637a9a *inst/NEWS.Rd
a87b0f223435ed35607e8514562b8bfe *LICENSE
2ddfa8d8739668eedda260e6ddc935d4 *man/charToFact.Rd
8f19a2c9feb2f352580fd4892650f285 *man/count.Rd
Expand All @@ -16,7 +16,7 @@ a137f7855b41b074e2babaf8a1562551 *man/shareData.Rd
54f91d543a10f8c9aef7082da2b86de7 *man/topn.Rd
a7f31cee15b9624dab8f4d13d3c66bad *man/vswitch.Rd
c797ca387dccc02751cfe85108fb0159 *NAMESPACE
24ce4885aedbca5309ed2ee126324aa2 *R/call.R
a19c6faffef01603c022f6291d46bf21 *R/call.R
2d6c06dfc570d456af125c160cf150d7 *README.md
b68e68fed386fa0ce15ec6ec2e1f91a5 *src/dup.c
17b8c354cd84b5d85ab5a62ef2bfab4e *src/dupLen.c
Expand All @@ -34,4 +34,4 @@ bafdafd654269acd054525571dbe1b44 *src/share.c
b9daa73f97bb19027aaa5bfdc00c4087 *src/utils.c
3476a1e2381bb86f68a72844ee61bc7b *src/vswitch.c
3f8dc4ecf4ad26fb959a2291ab167630 *tests/test_kit.R
de61e8bccc19816a0e07c9153a33473b *tests/test_kit.Rout.save
f0b7442cb1c46dd6a5f7344199bc1ac4 *tests/test_kit.Rout.save
9 changes: 7 additions & 2 deletions R/call.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ topn = function(vec, n=6L, decreasing=TRUE, hasna=TRUE,index=TRUE) if(ind
uniqLen = function(x) .Call(CdupLenR, x)
vswitch = function(x, values, outputs, default=NULL, nThread=getOption("kit.nThread"), checkEnc = TRUE) .Call(CvswitchR, x, values, outputs, default, nThread, checkEnc)

.onAttach = function(libname, pkgname) packageStartupMessage(paste0("Attaching kit 0.0.15 (OPENMP ",if(.Call(CompEnabledR)) "enabled" else "disabled"," using 1 thread)"))
.onLoad = function(libname, pkgname) options("kit.nThread"=1L) #nocov
.onAttach = function(libname, pkgname) packageStartupMessage(paste0("Attaching kit 0.0.16 (OPENMP ",if(.Call(CompEnabledR)) "enabled" else "disabled"," using 1 thread)"))
.onUnload = function(libpath) library.dynam.unload("kit", libpath) #nocov

.onLoad = function(libname, pkgname) {
if (!("kit.nThread" %in% names(options()))) {
options("kit.nThread"=1L)
}
}

pcount = function(..., value) {
if(is.na(value[1])) {
.Call(CpcountNAR, if (...length() == 1L && is.list(..1)) ..1 else list(...))
Expand Down
8 changes: 8 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}

\section{version 0.0.16 (2024-03-01)}{
\subsection{Notes}{
\itemize{
\item Check if \code{"kit.nThread"} is defined before setting it to \code{1L}
}
}
}

\section{version 0.0.15 (2023-10-01)}{
\subsection{Notes}{
\itemize{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_kit.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Type 'q()' to quit R.
+ }
>
> library(kit); unloadNamespace("kit")
Attaching kit 0.0.15 (OPENMP enabled using 1 thread)
Attaching kit 0.0.16 (OPENMP enabled using 1 thread)
>
> topn = kit::topn
> setlevels = kit::setlevels
Expand Down

0 comments on commit 0d948ca

Please sign in to comment.