CUDA中没有现有的内在__ vmulus8()
。但是,可以使用现有的内在物进行模拟。基本上,我们可以使用两个32位变量将四个8位数量的四个16位产品包装。然后将每种产品夹至255,并在置入操作的帮助下将每种产品的最小字节提取到最终结果中。 CUDA 11为计算功能生成的代码看起来合理。性能是否足够取决于用例。如果此操作发生在用包装字节的处理管道计算的中间,则应该是这种情况。
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/* byte-wise multiply with unsigned saturation */
__device__ unsigned int vmulus4 (unsigned int a, unsigned int b)
{
unsigned int plo, phi, res;
// compute products
plo = ((a & 0x000000ff) * (b & 0x000000ff) +
(a & 0x0000ff00) * (b & 0x0000ff00));
phi = (__umulhi (a & 0x00ff0000, b & 0x00ff0000) +
__umulhi (a & 0xff000000, b & 0xff000000));
// clamp products to 255
plo |= __vcmpne2 (plo & 0xff00ff00, 0x00000000);
phi |= __vcmpne2 (phi & 0xff00ff00, 0x00000000);
// extract least significant eight bits of each product
res = __byte_perm (plo, phi, 0x6420);
return res;
}
__global__ void kernel (unsigned int a, unsigned int b, unsigned int *res)
{
*res = vmulus4 (a, b);
}
unsigned int vmulus4_ref (unsigned int a, unsigned int b)
{
unsigned char a0, a1, a2, a3, b0, b1, b2, b3;
unsigned int p0, p1, p2, p3;
a0 = (a >> 0) & 0xff;
a1 = (a >> 8) & 0xff;
a2 = (a >> 16) & 0xff;
a3 = (a >> 24) & 0xff;
b0 = (b >> 0) & 0xff;
b1 = (b >> 8) & 0xff;
b2 = (b >> 16) & 0xff;
b3 = (b >> 24) & 0xff;
p0 = (unsigned int)a0 * (unsigned int)b0;
p1 = (unsigned int)a1 * (unsigned int)b1;
p2 = (unsigned int)a2 * (unsigned int)b2;
p3 = (unsigned int)a3 * (unsigned int)b3;
if (p0 > 255) p0 = 255;
if (p1 > 255) p1 = 255;
if (p2 > 255) p2 = 255;
if (p3 > 255) p3 = 255;
return (p0 << 0) + (p1 << 8) + (p2 << 16) + (p3 << 24);
}
// George Marsaglia's KISS PRNG, period 2**123. Newsgroup sci.math, 21 Jan 1999
// Bug fix: Greg Rose, "KISS: A Bit Too Simple" http://eprint.iacr.org/2011/007
static uint32_t kiss_z=362436069, kiss_w=521288629;
static uint32_t kiss_jsr=123456789, kiss_jcong=380116160;
#define znew (kiss_z=36969*(kiss_z&65535)+(kiss_z>>16))
#define wnew (kiss_w=18000*(kiss_w&65535)+(kiss_w>>16))
#define MWC ((znew<<16)+wnew )
#define SHR3 (kiss_jsr^=(kiss_jsr<<13),kiss_jsr^=(kiss_jsr>>17), \
kiss_jsr^=(kiss_jsr<<5))
#define CONG (kiss_jcong=69069*kiss_jcong+1234567)
#define KISS ((MWC^CONG)+SHR3)
int main (void)
{
unsigned int *resD = 0;
unsigned int a, b, res, ref;
cudaMalloc ((void**)&resD, sizeof resD[0]);
for (int i = 0; i < 1000000; i++) {
a = KISS;
b = KISS;
kernel<<<1,1>>>(a, b, resD);
cudaMemcpy (&res, resD, sizeof res, cudaMemcpyDeviceToHost);
ref = vmulus4_ref (a, b);
if (res != ref) {
printf ("error: a=%08x b=%08x res=%08x ref=%08x\n", a, b, res, ref);
return EXIT_FAILURE;
}
}
cudaFree (resD);
return EXIT_SUCCESS;
}
如果将函数称为(您可能必须提供其他参数),
test('www','find_all')
则可以在函数中调用方法“ find_all”,例如:
result = getattr(soup, function)(*lst)
我可以想到两个问题为什么这不起作用。
- 首先,您要访问
themedata
darktheme
中定义的,但是您的thememode
并不暗。因此,在Interialt> Interialapp
addthememode:thememode.dark
参数。 - 其次,您调用
theme.of(context)的按钮.primarycolor
在窗口小部件与主题定义相同,而您的上下文
仍然没有该数据。因此,只有当前小部件的儿童的上下文才有此数据。解决方案是在其内部使用按钮制作一个新的小部件,或用Builder
窗口小部件包装您的按钮,其构建器内部具有上下文。
您的问题可以是第一,第二或两者。
一种可能的解决方案是使用以下代码停止postgres.exe背景过程:
taskkill /fi“ imagename eq postgres.exe” /t
这是因为响应的默认类型为json
,您需要将响应设置为text
才能实现此目的:
public createXML(data:IJob)
{
console.log("createXML - POST data to server: ", data);
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'application/xml');
return this.httpClient.post<any>(
environment.restUrl + "/createXML/",
data,
{
responseType: "text" // this is
}
).pipe(
tap((data) => console.log(data)),
catchError(this.handleError)
);
}
有关更多信息,您可以看到<<。 a href =“ https://angular.io/guide/http#making-a-post-request” rel =“ nofollow noreferrer”>如何制作邮政请求
nosuchelementException 是不同的web驱动器例外之一,当定位器(即id/xpath/css selectors等Selenium程序代码无法在网页上找到Web元素。获得此例外有两种可能性,即我们提供了一个不正确的定位器,试图找到Web元素,或者我们提供了正确的定位器,但是与定位器相关的
Web元素
在网页上可用。
请尝试使用以下
xpath
//input[@placeholder='Search for an item']
css selector
input[placeholder='Search for an item']
vba
中不知道,在java
中,请在元素上找到一些等待
,如下
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
WebElement elem = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@placeholder='Search for an item']")));
elem.sendKeys("ABC");
希望这样回答您的问题
更新:此答案是较早版本的打字稿中的最佳解决方案,但是较新版本中有更好的选项(请参阅其他答案)。
公认的答案有效,在某些情况下可能需要,但没有提供任何类型的安全性来构建对象的缺点。如果您尝试添加未定义的属性,此技术至少会丢弃类型错误。
interface F { (): any; someValue: number; }
var f = <F>function () { }
f.someValue = 3
// type error
f.notDeclard = 3
您可以按行解析文件。您将将当前块作为数组变量,将其填充,因为排除行,当新块启动时,只需将上一个块添加到最终结果阵列中。
以下代码使用基本函数(而不是$ this-&gt;
调用,就像您在问题中一样)。您可以根据需要更新代码。
<?php
// the file was placed on my server for testing
$file = fopen('test.txt','r');
// this will contain the final result
$result = [];
// currentBlock is null at first
$currentBlock = null;
while (($line = fgets($file)) !== false) {
// extracting the line code
$lineCode = substr($line, 0, 14);
// checking if the row contains a value, between two '
$rowComponents = explode("'", $line);
if (count($rowComponents) < 2) {
// the row is not formatted ok
continue;
}
$value = $rowComponents[1];
switch ($lineCode) {
case 'S10.G00.00.001':
$website = $value;
break;
case 'S10.G00.00.002':
$companyName = $value;
break;
case 'S10.G00.00.003':
$version = $value;
break;
case 'S21.G00.30.001':
// starting a new entry
if ($currentBlock !== null) {
// we already have a block being parsed
// so we added it to the final result
$result[] = $currentBlock;
}
// starting the current block as an empty array
$currentBlock = [];
$currentBlock['property1'] = $value;
break;
case 'S21.G00.30.002':
$currentBlock ['property2'] = $value;
break;
case 'S21.G00.30.004':
$currentBlock ['property4'] = $value;
break;
}
}
// adding the last entry into the final result
// only if the block exists
if ($currentBlock !== null) {
$result[] = $currentBlock;
}
fclose($file);
// output the result for debugging
// you also have the $website, $companyName, $version parameters populated
var_dump($result);
?>
滚动运行后,我从var_dump
调用:
array(3) {
[0]=>
array(3) {
["property1"]=>
string(12) "employee one"
["property2"]=>
string(4) "AAAA"
["property4"]=>
string(4) "BBBB"
}
[1]=>
array(3) {
["property1"]=>
string(10) "employee 2"
["property2"]=>
string(4) "CCCC"
["property4"]=>
string(4) "DDDD"
}
[2]=>
array(3) {
["property1"]=>
string(10) "employee 3"
["property2"]=>
string(4) "EEEE"
["property4"]=>
string(4) "FFFF"
}
}
例如,我将各种字符串长度插入Sheet1!b1:b20
使用= pept(“
Sub Test()
Dim MySheet As Worksheet
Set MySheet = ThisWorkbook.Worksheets("Sheet1")
Dim Name_Column As Long
Name_Column = 2
Dim iloop_line As Long
Dim StringValue As String
For iloop_line = 1 To 20
StringValue = LCase(MySheet.Cells(iloop_line, Name_Column))
Debug.Print StringValue & "_addr" & Space(30 - Len(StringValue & "_addr")) & ": std_logic_vector"
Debug.Print StringValue & "_val" & Space(30 - Len(StringValue & "_val")) & ": std_logic_vector"
Next iloop_line
End Sub
上面的代码为我提供了下面的输出 - :
始终是第31个字符。
aaaaaaaaaaa_addr : std_logic_vector
aaaaaaaaaaa_val : std_logic_vector
aaaaaaaaaaaa_addr : std_logic_vector
aaaaaaaaaaaa_val : std_logic_vector
aaaaaaaaaa_addr : std_logic_vector
aaaaaaaaaa_val : std_logic_vector
aaaaaaaaaa_addr : std_logic_vector
aaaaaaaaaa_val : std_logic_vector
编辑:很尴尬 - 从vba中的space
命令不知道。已经更新了代码,而不是rept
。想想上次我使用的可能是Sinclair Basic。
您的代码(带有我的评论)
def min_variance(mean_returns, cov_matrix):
num_assets = len(mean_returns)
args = (mean_returns, cov_matrix)
constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
bound = (0.0,1.0)
bounds = tuple(bound for asset in range(num_assets))
# this is un-indented, which to Python means
# it's a line of code outside the min_variance method
result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
method='SLSQP', bounds=bounds, constraints=constraints)
return result
您的result =
行未注明,因此它不是min_variance
方法的一部分。
如果您缩进它,它应该看起来像这样并解决您的直接问题。
def min_variance(mean_returns, cov_matrix):
num_assets = len(mean_returns)
args = (mean_returns, cov_matrix)
constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
bound = (0.0,1.0)
bounds = tuple(bound for asset in range(num_assets))
result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
method='SLSQP', bounds=bounds, constraints=constraints)
return result
听起来您尝试连接时使用localhost
作为主机名。
在Docker上下文中,localhost
是容器本身。您可以将其服务名称作为主机名称连接到另一个容器。
因此,当连接从Human_Cloning_Facities到Jedi_service时,您应该使用http://jedi_service:8082/
,并且从Jedi_service连接到Human_Cloning_facilities到Human_Cloning_facities代码>。
在Docker创建的桥梁网络上的容器之间连接时,您应该使用容器端口。这在您的情况下并没有改变,因为您将端口映射到主机上的同一端口号。但是,如果您只需要访问网络上其他容器的容器,则无需将端口映射到主机端口。仅当您需要从主机访问容器时才需要。
您可以在无线电输入上设置V-Model
,并使用计算的属性过滤数据:
new Vue({
el: "#demo",
data() {
return {
checks: ['Developer','Tester', 'Designer', 'Support'],
infojobs: [{genres: 'Developer', position:'Senior Java Engineer, Big Data', exprerience:'3-5 Years', salary:'', headequarters:'', content1:'A', content2:'B', content3:'C'}],
selected: null,
display: ''
}
},
computed: {
filtered() {
if (this.selected) return this.infojobs.filter(i => i.genres === this.selected)
return this.infojobs
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
<div class="job-filter">
<h3>Filter</h3>
<div class="radio-group" id="group-filter" :class="{ 'display-block': this.display }">
<div class="radio-check pdt-10 ">
<input type="radio" name="fav_language" v-model="selected" value="">
<label for="">Tất cả</label><br>
</div>
<div class="radio-check" v-for="(check, index) in checks" :key="index">
<input type="radio" :id="index" :value="check" name="fav_language" v-model="selected" >
<label for="">{{check}}</label><br>
</div>
{{selected}}
</div>
</div>
<div class="search">
<div class="search-top flex-wrap">
<h5>22 tin tuyển dụng</h5>
<div class="search-input">
<input type="search" placeholder="Nhập từ khóa để tìm kiếm">
<button><img src="../assets/recruit/search.svg" alt=""></button>
</div>
</div>
<div class="job-item" v-for="(item, index) in filtered" :key="index">
<h3 class="mleft-27">{{item.position}}</h3>
<div class="job-info flex-wrap">
<div class="job-info-left pleft-27 flex-wrap">
<div>
<img src="../assets/recruit/years.svg" alt="">
<b>{{item.exprerience}}</b>
</div>
<div>
<img src="../assets/recruit/luong.svg" alt="">
<b>{{item.salary}}</b>
</div>
<div>
<img src="../assets/recruit/diadiem.svg" alt="">
<b>{{item.headequarters}}</b>
</div>
</div>
<div>
<h6>2 ngày trước</h6>
</div>
</div>
<div class="info-job flex-wrap">
<div class="list-info-job">
<ul>
<li>{{item.content1}}</li>
<li>{{item.content2}}</li>
<li>{{item.content3}}</li>
</ul>
</div>
<a href="/detail">
<button class="btn-detail" >Xem chi tiết</button>
</a>
</div>
</div>
</div>
</div>
有了这两个规则,有一个替代方案都不匹配,然后重复。重复一件事不匹配的东西是不行的。
通过重新格式化规则,很明显,替代方案无匹配:
rfc5322_obsBody
: ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)* // alternative 1
| CRLF // alternative 2
)*
;
rfc5322_obsUnstruct
: ( LFD* CR* (rfc5322_obsUText LFD* CR*)* // alternative 1
| rfc5322_fws // alternative 2
)*
;
在这两种情况下,替代1都不匹配任何匹配(然后用*
重复)。
在这两种情况下,您都应该能够将内部*
(零或更多)更改为+
(一次或多个):
rfc5322_obsBody
: ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)+ // alternative 1
| CRLF // alternative 2
)* // <- outer *
;
rfc5322_obsUnstruct
: ( LFD* CR* (rfc5322_obsUText LFD* CR*)+ // alternative 1
| rfc5322_fws // alternative 2
)* // <- outer *
;
这将导致替代1匹配某物,但是,外部*
仍然会导致整个规则仍然没有匹配,因此您可以在那里。
不,crontab中没有任何选择来修改cron文件。
您必须:获取当前的cron文件(crontab -l&gt; newfile),对其进行更改并将新文件放置在适当的位置(crontab newfile)。
如果您熟悉PERL,则可以使用此模块 config :: crontab 。
LLP,安德里亚
No, there is no option in crontab to modify the cron files.
You have to: take the current cron file (crontab -l > newfile), change it and put the new file in place (crontab newfile).
If you are familiar with perl, you can use this module Config::Crontab.
LLP, Andrea
如何在没有交互式编辑器的情况下使用BASH创建CRON作业?