The factor calculation is very small, how do I use parallel computing to speed it up?

Viewed 27

For example, I need to calculate Alpha147 factor. The script is shown as follows:

def alpha147SQL(vector) {
    ...
}

input = select tradingdate, symbol, closeprice from loadTable("dfs://xxxx", "level2") where tradingdate = 2020.01.02
alpha147DDBSql = select alpha147SQL(closeprice) from input context by symbol
1 Answers

You can use a partition in-memory table to execute the computing in parallel. The code for optimization is shown following:

def alpha147SQL(vector) {
    ...
}

input = select tradingdate, symbol, closeprice from loadTable("dfs://shenwan", "level2") where tradingdate = 2020.01.02
db = database("", HASH, [SYMBOL, 20])
pt = db.createPartitionedTable(input, "input", `symbol)
pt.append!(input)
timer(10) { pnodeRun(clearAllCache) }
timer alpha147DDBSql = select alpha147SQL(closeprice) from pt context by symbol
Related