使用gpuR软件包将GPUvector转换回CPU向量

时间:2018-06-20 05:51:00

标签: r gpu

library(gpuR)

A <- seq.int(from=0, to=999)
B <- seq.int(from=1000, to=1)
gpuA <- gpuVector(A)
gpuB <- gpuVector(B)

C <- A + B
gpuC <- gpuA + gpuB

gpuCgpuvector。我想将输出视为数值。因此我尝试转换为cpuvector。在RCUDA包中,gathergpu()中存在函数。但gpuR包中没有类似的功能。

1 个答案:

答案 0 :(得分:1)

您可以使用 public string SaveNewsDetails(List<TempNews> listTempNews, int RowCount) { int value; string NewsStatus = string.Empty; StringBuilder sqlBuilder = new StringBuilder(); DataAccess db = DataAccess.Create("Conn"); try { using (var trn = db.BeginTransaction()) { foreach (var item in listTempNews) { IEnumerable<string> newsList = null; sqlBuilder.Append("SELECT NewsCode "); sqlBuilder.Append("FROM T_NEWS "); sqlBuilder.Append("WHERE NewsCode = '" + item.N_Code + "'"); newsList = trn.Query<string>(sqlBuilder.ToString()); if (newsList == null || newsList.Count() == 0) { // Insert to table Query goes here } else { // Update Query Goes here } trn.Execute(sqlBuilder.ToString()); } trn.Complete(); } } catch (Exception Ex) { } return NewsStatus; } 引用值,而无需任何参数:

[