根据标题,是否有一种简单的方法可以在VS 2015中链接Armadillo和NVBLAS?
目前我已经在VS中安装了MKL,一切都运行得很完美.我已经在VS中安装了带有扩展的CUDA Toolkit 8,我可以以某种方式指示Armadillo在CUDA中使用(可用的)BLAS例程吗?
我试图使用aleagpu但我得到System.TypeInitializationException.我试图谷歌问题是什么,但我找不到任何解决方案,所以请帮助.该计划是最简单的:
class Klazz
{
private const int N = 100;
private const int Length = 10000000;
var gpu = Gpu.Default;// here is the Exception thrown
public static void Unmanaged()
{
var data = new int[Length];
for (var k = 0; k < N; k++)
gpu.For(0, data.Length, i => data[i] += 1);
}
}
Run Code Online (Sandbox Code Playgroud)
我想象我的安装有问题,因为该程序是来自aleagpu主页的复制示例.
我的系统是:
Alea于2016年11月9日从NuGet安装
PATH中的变量是正确的.
我已经尝试了AleaSample.CS.ParallelForAutoMemMgt以及相同的结果.
我已经在 Ubuntu 16.10 环境中从 Source 安装了 tensorflow。一切都很顺利,但现在在编译程序时,它显示以下错误:
Traceback (most recent call last):
File "ff.py", line 3, in <module>
sess = tf.InteractiveSession()
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
Run Code Online (Sandbox Code Playgroud)
没有找到与此相关的帖子。有人可以帮忙吗?
我试图编译YOLO GPU = 1,OPENCV = 1,DEBUG = 1.与DEBUG = 0相同的组合已成功编译,但是当我使用DEBUG = 1时,导致编译失败.
>>make
gcc -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -O0 -g -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.o
gcc -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -O0 -g -DOPENCV -DGPU -c ./src/utils.c -o obj/utils.o
gcc -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -O0 -g -DOPENCV -DGPU -c ./src/cuda.c -o obj/cuda.o
gcc -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -O0 -g -DOPENCV -DGPU -c ./src/convolutional_layer.c -o …Run Code Online (Sandbox Code Playgroud) 为了在没有 cuda 的情况下运行 TensorFlow verbs 代码,我用 GOOGLE_CUDA 的定义关闭了部分代码。当我尝试运行代码时,我发现 GOOGLE_CUDA 在我的文件中始终未定义,即使当我使用 cuda 构建 TensorFlow 时也是如此,但在使用它的其他文件中,它已定义。我应该怎么做才能让我的代码知道这个定义?
我正在使用Keras和CNTK(后端)
我的代码是这样的:
def run_han(embeddings_index, fname, opt)
...
sentence_input = Input(shape=(MAX_SENT_LENGTH,), dtype='int32')
embedded_sequences = embedding_layer(sentence_input)
l_lstm = Bidirectional(GRU(GRU_UNITS, return_sequences=True, kernel_regularizer=l2_reg,
implementation=GPU_IMPL))(embedded_sequences)
l_att = AttLayer(regularizer=l2_reg)(l_lstm)
sentEncoder = Model(sentence_input, l_att)
review_input = Input(shape=(MAX_SENTS, MAX_SENT_LENGTH), dtype='int32')
review_encoder = TimeDistributed(sentEncoder)(review_input)
l_lstm_sent = Bidirectional(GRU(GRU_UNITS, return_sequences=True, kernel_regularizer=l2_reg,
implementation=GPU_IMPL))(review_encoder)
l_att_sent = AttLayer(regularizer=l2_reg)(l_lstm_sent)
preds = Dense(n_classes, activation='softmax', kernel_regularizer=l2_reg)(l_att_sent)
model = Model(review_input, preds)
model.compile(loss='categorical_crossentropy',
optimizer=opt, #SGD(lr=0.1, nesterov=True),
metrics=['acc'])
...
model.fit(x_train[ind,:,:], y_train[ind,:], epochs=NUM_EPOCHS, batch_size=BATCH_SIZE, shuffle=False,
callbacks=[cr_result, history, csv_logger],
verbose=2,validation_data=(x_test, y_test), class_weight = class_weight)
...
%xdel model
gc.collect()
Run Code Online (Sandbox Code Playgroud)
更改优化程序时,我多次调用上述模型。像这样:
opt = optimizers.RMSprop(lr=0.0001, …Run Code Online (Sandbox Code Playgroud) 我正在尝试为一个非常大的输入 (5*100,000,000) 训练一个神经网络,它需要比预期更多的内存。这是一些最小的例子:
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import time
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv1d(in_channels=5, out_channels=1, kernel_size=100000000, stride=10)
def forward(self, x):
x = self.conv1(x)
x = torch.sigmoid(x)
return x
model = Net().cuda()
optimizer = optim.Adam(model.parameters(), lr=0.001)
criterion = torch.nn.BCELoss()
data = torch.normal(torch.zeros(1,5,100000000),torch.ones(1,5,100000000))
data = data.cuda()
label = torch.ones(1,1,1)
label = label.cuda()
for epoch in range(10):
output = model(data)
loss = criterion(output, label)
optimizer.zero_grad()
loss.backward()
optimizer.step()
print("Epoch :", …Run Code Online (Sandbox Code Playgroud) 我试图通过嵌入在计算机上重新执行GitHub项目以进行推荐,目的是在完成集成后首先嵌入存在于movieLens数据集中的用户和项目,然后使用内部产品来预测评分在所有组件中,我在训练中都出错了。
码:
from lightfm.datasets import fetch_movielens
movielens = fetch_movielens()
ratings_train, ratings_test = movielens['train'], movielens['test']
def _binarize(dataset):
dataset = dataset.copy()
dataset.data = (dataset.data >= 0.0).astype(np.float32)
dataset = dataset.tocsr()
dataset.eliminate_zeros()
return dataset.tocoo()
train, test = _binarize(movielens['train']), _binarize(movielens['test'])
class ScaledEmbedding(nn.Embedding):
""" Change the scale from normal to [0,1/embedding_dim] """
def reset_parameters(self):
self.weight.data.normal_(0, 1.0 / self.embedding_dim)
if self.padding_idx is not None:
self.weight.data[self.padding_idx].fill_(0)
class ZeroEmbedding(nn.Embedding):
def reset_parameters(self):
self.weight.data.zero_()
if self.padding_idx is not None:
self.weight.data[self.padding_idx].fill_(0)
class BilinearNet(nn.Module):
def __init__(self, num_users, num_items, embedding_dim, sparse=False):
super().__init__()
self.embedding_dim = …Run Code Online (Sandbox Code Playgroud) 我正在研究密码学,其中包括非常大的大约2048位大小的整数。我已经在 python 中返回了我的算法并且工作正常。现在,我需要用 GPU 加速这个算法。所以,我使用 numba 进行加速。我收到以下错误。请帮助我处理非常大的整数。
ValueError异常:int值过大:92258844410360056197837473187695644910346254368316703862914922507771377266980480337680534948953927388850060454071957519321942465209478761155937984413689971094452635917678279011141842700271439588766362468089643758626551820024243785880479259172494136586386527772928225026351839534218119545890907368759523376112
这是我在 ubuntu 20.04 上使用 cuda 10.1 编译 OpenCV 时遇到的错误。
-- Detected processor: x86_64
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUBLAS (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:249 (OCV_OPTION)
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUDNN (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:252 (OCV_OPTION)
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Could NOT find OpenJPEG (minimal suitable version: …Run Code Online (Sandbox Code Playgroud)