我不久前写了几个three.js(R48)应用程序,他们一直工作正常,直到几周我发现他们不再使用Chrome.
以下是前几条错误消息:
WebGL: INVALID_OPERATION: getAttribLocation: program not linked skyWheel.html:1
8
WebGL: INVALID_OPERATION: getUniformLocation: program not linked skyWheel.html:1
Could not initialise shader
VALIDATE_STATUS: false, gl error [1282] Three.js:355
29
WebGL: INVALID_OPERATION: getUniformLocation: program not linked
Run Code Online (Sandbox Code Playgroud)
它仍适用于Firefox.
所以我下载了最新版本的three.js,当我使用它而不是旧版本时,我收到此消息并且它不起作用.(这是在Firefox上)
[21:50:32.679] TypeError: material is undefined @ file:Three.js:23513
Run Code Online (Sandbox Code Playgroud)
我只是希望最近有人去过这种类型的东西,可以节省一些时间来解决这些问题.
这是我想要转换为openCL的循环.
for(n=0; n < LargeNumber; ++n) {
for (n2=0; n2< SmallNumber; ++n2) {
A[n]+=B[n2][n];
}
Re+=A[n];
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是我所拥有的,但我知道这是不正确的,并且缺少一些东西.
__kernel void openCL_Kernel( __global int *A,
__global int **B,
__global int *C,
__global _int64 Re,
int D)
{
int i=get_global_id(0);
int ii=get_global_id(1);
A[i]+=B[ii][i];
//barrier(..); ?
Re+=A[i];
}
Run Code Online (Sandbox Code Playgroud)
我是这类事的初学者.首先我知道我无法将全局双指针传递给openCL内核.如果可以的话,在发布解决方案之前等待几天左右,我想为自己解决这个问题,但如果你能帮我指出正确的方向,我将不胜感激.
我把这个解决方案写给Project Euler#5.
import time
start_time = time.time()
def ProjectEulerFive (m = 20):
a = m
start = 2
while (m % start) == 0:
start += 1
b = start
while b < m:
if ( a % b) != 0:
a += m
b = start
continue
else:
b += 1
return a
import sys
if (len(sys.argv)) > 2:
print "error: this function takes a max of 1 argument"
elif (len(sys.argv)) == 2:
print ProjectEulerFive(int(sys.argv[1]))
else:
print …Run Code Online (Sandbox Code Playgroud) 这不是一个功课问题,我只是对我对间隔算术的理解以及练习2.16的含义不满意.
由2.14节定义的区间算术不具有正常算术的属性.两个应该是等效的操作,(r1*r2)/(r1 + r2)和1 /(1/r1 + 1/r2),给出不同的结果.练习询问为什么会出现这种情况,并且如果有可能构造一个间隔算术系统,而不是这种情况.
本节讨论计算电气元件电阻的误差范围.我不确定我理解用这些术语来表示乘法和除法间隔是什么意思.将两个区间相乘的应用是什么?
在这个例子中是否可以构造一个没有问题的区间运算系统?
http://mitpress.mit.edu/sicp/full-text/book/book-ZH-14.html#%_sec_2.1.4
(define (make-interval a b)
(cons a b))
(define (make-center-width c w)
(make-interval (- c w) (+ c w)))
(define (make-center-percent c p)
(make-center-width c (* c (/ p 100.0))))
(define (lower-bound i)
(car i))
(define (upper-bound i)
(cdr i))
(define (center i)
(/ (+ (upper-bound i) (lower-bound i)) 2))
(define (width i)
(/ (- (upper-bound i) (lower-bound i)) 2))
(define (percent i)
(* 100.0 (/ (width i) (center i))))
(define …Run Code Online (Sandbox Code Playgroud) 我为visual studio阻止了网络连接.使用visual studio add in安装Qt SDK后,收到错误消息,无法连接到AppWrapper.卸载了SDK,不再尝试连接到AppWrapper.什么是Qt安装的AppWrapper?为什么在打开Visual Studio时会尝试建立网络连接?
我该如何解决以下类型的循环依赖?
//A.hpp
#include "B.hpp"
struct A {
B b;
int foo();
};
//A.cpp
#include "A.hpp"
int A::foo{
b.fi(*this);
}
//B.hpp
struct A;
struct B {
int fi(const A &a);
};
//B.cpp
#include "B.hpp"
int B::fi(const A &a){
if(a.something())
something_else();
}
Run Code Online (Sandbox Code Playgroud) 我需要完成的任务遇到性能问题。目前的瓶颈之一是从非结构化网格获取插值字段值。
缓慢的部分是,给定一个 2D 点和一个非结构化的 2D 网格,找到紧邻该点的网格点。如果能找到它落入的三角形就好了。
现在我正在使用CGAL,但它太慢了。按照目前的实施方式,整个任务需要几天时间才能完成,并在高端 CPU 上并行运行。
我相信缓慢的部分是 CGAL::natural_neighbor_coordinates_2。
#ifndef FIELD_INTERPOLATOR_H
#define FIELD_INTERPOLATOR_H
#include "Vec.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Interpolation_traits_2.h>
#include <CGAL/natural_neighbor_coordinates_2.h>
#include <CGAL/interpolation_functions.h>
#include <map>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Delaunay_triangulation_2< Kernel > Delaunay_triangulation;
typedef Kernel::FT FieldType;
typedef Kernel::Point_2 MeshType;
struct FieldInterpolator23 {
Delaunay_triangulation m_triangulation;
std::map< MeshType, FieldType, Kernel::Less_xy_2 > m_vX;
std::map< MeshType, FieldType, Kernel::Less_xy_2 > m_vY;
std::map< MeshType, FieldType, Kernel::Less_xy_2 > m_vZ;
typedef CGAL::Data_access< std::map< MeshType, FieldType, Kernel::Less_xy_2 > > ValueAccess;
FieldInterpolator23() {}
FieldInterpolator23( …Run Code Online (Sandbox Code Playgroud) 我是一个非常新的程序员,我对intel的例子有些麻烦.我认为如果能看到tbb中最基本的可能循环是如何实现的话会有所帮助.
for (n=0 ; n < songinfo.frames; ++n) {
sli[n]=songin[n*2];
sri[n]=songin[n*2+1];
}
Run Code Online (Sandbox Code Playgroud)
这是我用来解交错音频数据的循环.这个循环会从tbb中受益吗?你会如何实现它?
我已经经历了一些例子,将一个元素数组减少到一个元素,但没有成功.有人在NVIDIA论坛上发布了此消息.我已经从浮点变量更改为整数.
__kernel void sum(__global const short *A,__global unsigned long *C,uint size, __local unsigned long *L) {
unsigned long sum=0;
for(int i=get_local_id(0);i<size;i+=get_local_size(0))
sum+=A[i];
L[get_local_id(0)]=sum;
for(uint c=get_local_size(0)/2;c>0;c/=2)
{
barrier(CLK_LOCAL_MEM_FENCE);
if(c>get_local_id(0))
L[get_local_id(0)]+=L[get_local_id(0)+c];
}
if(get_local_id(0)==0)
C[0]=L[0];
barrier(CLK_LOCAL_MEM_FENCE);
}
Run Code Online (Sandbox Code Playgroud)
这看起来不错吗?第三个参数"大小",应该是本地工作规模,还是全球工作规模?
我设置了这样的论点,
clSetKernelArg(ocReduce, 0, sizeof(cl_mem), (void*) &DevA);
clSetKernelArg(ocReduce, 1, sizeof(cl_mem), (void*) &DevC);
clSetKernelArg(ocReduce, 2, sizeof(uint), (void*) &size);
clSetKernelArg(ocReduce, 3, LocalWorkSize * sizeof(unsigned long), NULL);
Run Code Online (Sandbox Code Playgroud)
第一个参数是输入,我试图保留从之前启动的内核的输出.
clRetainMemObject(DevA);
clEnqueueNDRangeKernel(hCmdQueue[Plat-1][Dev-1], ocKernel, 1, NULL, &GlobalWorkSize, &LocalWorkSize, 0, NULL, NULL);
//the device memory object DevA now has the data to be …Run Code Online (Sandbox Code Playgroud) 我正在尝试在shell脚本中获取命令历史记录.除非我拿出#!/ bin/bash,否则它不起作用
有关如何使其工作,或在不删除#!/ bin/bash的情况下实现相同效果的任何线索?
任何人都知道为什么它可以删除#!/ bin/bash?