小编Cha*_*nam的帖子

使用线程池时出现错误 FutureTask@2c7b84de 被拒绝

这是我的代码:

class Processor implements Runnable {

    private int id;
    private Integer interaction;
    private Set<Integer> subset;
    private static volatile AtomicBoolean notRemoved = new AtomicBoolean(true);

    public Object<E> dcp;
    public Iterator<Integer> iterator;



    public Processor(int id, Integer interaction, Set<Integer> subset, Object<E> dcp, Iterator<Integer> iterator) {
        this.id = id;
        this.interaction = interaction;
        this.subset= subset;
        this.dcp = dcp;
        this.iterator = iterator;
    }

    public void run() {
        while (Processor.notRemoved.get()){
            System.out.println("Starting: " + this.id);
            if (this.dcp.PA.contains(this.interaction)){
                this.subset.add(this.interaction);
                this.dcp.increaseScore(this.subset);
                if (!this.subset.contains(this.interaction) && Processor.notRemoved.get()){
                    Processor.notRemoved.set(false);
                    iterator.remove();
                }
            }

            System.out.println("Completed: " …
Run Code Online (Sandbox Code Playgroud)

java concurrency multithreading java.util.concurrent threadpool

3
推荐指数
1
解决办法
5388
查看次数

TensorFlow选择GPU以从多个GPU中使用

我是TensorFlow的新手,按照TensorFlow网站上的说明安装了CUDA-7.5和cudnn-v4.调整TensorFlow配置文件并尝试从网站运行以下示例:

python -m tensorflow.models.image.mnist.convolutional
Run Code Online (Sandbox Code Playgroud)

我很确定TensorFlow正在使用其中一个GPU而不是另一个,但是,我希望它能使用速度更快的GPU.我想知道这个示例代码是否默认使用它找到的第一个GPU.如果是这样,我如何在python中的TensorFlow代码中选择使用哪个GPU?

运行示例代码时得到的消息是:

ldt-tesla:~$ python -m tensorflow.models.image.mnist.convolutional
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties:
name: Tesla K20c
major: 3 minor: 5 memoryClockRate (GHz) 0.7055
pciBusID 0000:03:00.0
Total memory: 4.63GiB …
Run Code Online (Sandbox Code Playgroud)

python cuda gpu tensorflow

1
推荐指数
1
解决办法
2868
查看次数