-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rprofile.site
171 lines (158 loc) · 7.28 KB
/
Rprofile.site
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# [1] "RProfile.site exists here in MRO: /usr/lib64/microsoft-r/3.4/lib64/R/etc/Rprofile.site"
# but will be in "/usr/lib64/R/etc/Rprofile.site"
# in the base R
# this is here to copy it in to the base R location becuase for some reason
# R stopped looking for it in the MRO location
if (!identical(system.file(package="RevoUtils"), "")) {
Revo.version <- RevoUtils:::makeRevoVersion()
repos.date <- utils::packageDescription("RevoUtils")$MRANDate
}
if (!identical(system.file(package="RevoScaleR"), "")) {
if (.Platform$OS.type == "windows"){
defaultRevoNodePath <- paste("C:\\Program Files\\Microsoft\\MRO-for-RRE\\", paste(Revo.version$major, substr(Revo.version$minor,1,1), sep="."), sep="")
defaultRNodePath <- utils::shortPathName(R.home())
} else {
defaultRevoNodePath <- paste("/usr/lib64/MRS-", paste(Revo.version$major, substr(Revo.version$minor,1,1), sep="."), sep="")
defaultRNodePath <- paste(defaultRevoNodePath, "/R-", paste(R.version$major, R.version$minor, sep="."), "/lib64/R", sep="")
}
}
local(
{
# set a CRAN mirror
r <- getOption("repos")
if (.Platform$OS.type == "unix") {
options(download.file.method = "curl")
}
r["CRAN"] <- RevoUtils::getRevoRepos()
options(repos=r)
MRS.is.client <- RevoUtils:::isMicrosoftRClient()
# set default packages
# For MicrosoftML, check to see if this is a supported platform (Windows, RHEL/Cent 7, Ubuntu 14.04/16.04)
isMMLSupported <- FALSE
if (identical(.Platform$OS.type,"windows")) {
isMMLSupported <- TRUE
}
if (identical(.Platform$OS.type, "unix") && length(grep("Ubuntu",Sys.info()["version"]))){
if (file.exists("/etc/lsb-release")){
UbuntuReleaseInfo <- scan("/etc/lsb-release", what="", sep="\n", quiet=TRUE)
if (identical(UbuntuReleaseInfo[2], "DISTRIB_RELEASE=14.04") || identical(UbuntuReleaseInfo[2], "DISTRIB_RELEASE=16.04")) {
isMMLSupported <- TRUE
}
}
}
if ( identical(.Platform$OS.type, "unix") && length(grep("el7.x86_64",Sys.info()["release"]))){
isMMLSupported <- TRUE
}
if (!identical(system.file(package="RevoScaleR") , "")){
options(defaultPackages=c(getOption("defaultPackages"), "rpart", "lattice", "RevoScaleR",
if(!identical(system.file(package="mrsdeploy"), "") && identical(.Platform$OS, "windows")) "mrsdeploy",
# we have MicrosoftML package
if(!identical(system.file(package="MicrosoftML"),"") && isMMLSupported) "MicrosoftML",
"RevoMods", "RevoUtils", "RevoUtilsMath"))
if (nchar(hostName <- Sys.getenv("REVOHADOOPHOST")) && nchar(portNumber <- Sys.getenv("REVOHADOOPPORT")))
{
RevoScaleR::rxHdfsConnect(hostName=hostName, portNumber=as.numeric(portNumber))
}
}
# branding information
.RevoVersionShort <- Revo.version$version.string
.RevoVersionShortLen <- regexpr("^.* \\d+\\.\\d+", .RevoVersionShort, perl=TRUE)
.RevoVersionShort <- substring(.RevoVersionShort, 1, attributes(.RevoVersionShortLen)$match)
if ("setWindowTitle" %in% getNamespaceExports("utils")) {
if (Revo.version$arch=="x86_64") {
.RevoVersionShort <- paste(.RevoVersionShort, "(64-bit)")
}
try(utils::setWindowTitle(paste(" - ", .RevoVersionShort)), silent=TRUE)
}
if (.Platform$OS.type == "unix" && capabilities("X11")) {
browseAvail <- Sys.which(c("firefox", "mozilla", "galeon", "opera", "xdg-open", "kfmclient", "gnome-moze-remote"))
if (any(browseAvail != "")) {
options(browser = browseAvail[which(browseAvail != "")[1]])
}
}
if (.Platform$OS.type == "windows" ) {
options(help_type="html")
}
load_if_installed <- function(package) {
if (!identical(system.file(package="RevoUtilsMath"), "")) {
do.call('library', list(package))
return(TRUE)
} else {
return(FALSE)
}
}
if (identical(system.file(package="RevoScaleR"), "")) {
if (load_if_installed("RevoUtilsMath")) {
ncores <- RevoUtilsMath::getMKLthreads()
} else {
MROversion <- paste(Revo.version$major, Revo.version$minor, sep=".")
MKLmsg <- "No performance acceleration libraries were detected. To take advantage of \nthe available processing power, also install MKL for R Open. Visit \nhttp://go.microsoft.com/fwlink/?LinkID=698301 for more details.\n"
}
if (Sys.info()["sysname"] == "Darwin") {
options(download.file.method = "libcurl")
hw.ncpu <- try(system('sysctl hw.physicalcpu', intern = TRUE))
if (!inherits(hw.ncpu, "try-error")) {
ncores <- sub("hw.physicalcpu: ", "", hw.ncpu)
MKLmsg = paste0("Multithreaded BLAS/LAPACK libraries detected. Using ", ncores, " cores for math algorithms.\n")
}
} else {
if (load_if_installed("RevoUtilsMath")) {
ncores <- RevoUtilsMath::getMKLthreads()
MKLmsg = ""
} else {
MROversion <- paste(Revo.version$major, Revo.version$minor, sep=".")
MKLmsg <- "No performance acceleration libraries were detected. To take advantage of \nthe available processing power, also install MKL for R Open. \n\nVisit http://go.microsoft.com/fwlink/?LinkID=698301 for more details."
}
}
} else {
ncores <- RevoUtilsMath::getMKLthreads()
MKLmsg <- ""
}
quiet <- any(match(c("-q", "--silent", "--quiet", "--slave"), commandArgs()), na.rm=TRUE)
if (!quiet && !identical(system.file(package="RevoScaleR") , "")) {
cat("Microsoft R Open ",R.version$major,".",R.version$minor,"\n",sep="")
cat("The enhanced R distribution from Microsoft\n",sep="")
cat("Microsoft packages Copyright (C)", Revo.version$year, "Microsoft\n\n")
if (MRS.is.client == FALSE) {
ScaleRPkgName <- "RevoScaleR"
pkgVersion <- utils::packageDescription(ScaleRPkgName)$Version
cat("Loading Microsoft R Server packages, version ", pkgVersion,".\n", sep = "")
} else {
RclientPkgName <- "MicrosoftR"
pkgVersion <- utils::packageDescription(RclientPkgName)$Version
cat("Loading Microsoft R Client packages, version ", pkgVersion,". \n", sep = "")
cat("Microsoft R Client limits some functions to available memory.\n")
cat("See: https://go.microsoft.com/fwlink/?linkid=799476 for information\n",sep="")
cat("about additional features.\n\n",sep="")
}
cat("Type 'readme()' for release notes, privacy() for privacy policy, or\n", sep = "")
cat("'RevoLicense()' for licensing information.\n\n", sep = "")
if (MKLmsg == "") {
cat(paste("Using the Intel MKL for parallel mathematical computing(using", ncores, "cores).\n", sep = " "))
} else {
cat(MKLmsg, MROversion, sep = " ")
}
cat(paste("Default CRAN mirror snapshot taken on ",repos.date, ".\n",sep=""))
cat("See: https://mran.microsoft.com/.", "\n\n", sep = "")
mrupdate::mrCheckForUpdates()
} else if (!quiet) {
cat("Microsoft R Open ",R.version$major,".",R.version$minor,"\n",sep="")
cat("The enhanced R distribution from Microsoft\n",sep="")
cat("Microsoft packages Copyright (C)", Revo.version$year, "Microsoft Corporation\n\n")
if (MKLmsg == "") {
cat(paste("Using the Intel MKL for parallel mathematical computing(using", ncores, "cores).\n", sep = " "))
} else {
cat(MKLmsg)
}
cat("\nDefault CRAN mirror snapshot taken on ",repos.date, ".", sep = "")
cat("\n", "See: https://mran.microsoft.com/.",sep="")
cat("\n\n")
}
}
)
# Somebody set up us the bomb
.libPaths(c('/rpkgs', .libPaths()))
# set a CRAN mirror
local({r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org/"
options(repos=r)})