runcpu: support -fopenmp (dynamic linking)
This commit is contained in:
@@ -25,7 +25,7 @@ verify_binaries = 0
|
|||||||
intrate,fprate:
|
intrate,fprate:
|
||||||
copies = 1 # EDIT to change number of copies (see above)
|
copies = 1 # EDIT to change number of copies (see above)
|
||||||
intspeed,fpspeed:
|
intspeed,fpspeed:
|
||||||
threads = 1 # EDIT to change number of OpenMP threads (see above)
|
threads = @@OpenMPThreads@@ # EDIT to change number of OpenMP threads (see above)
|
||||||
|
|
||||||
|
|
||||||
#------- Compilers ------------------------------------------------------------
|
#------- Compilers ------------------------------------------------------------
|
||||||
@@ -115,4 +115,4 @@ default=base:
|
|||||||
|
|
||||||
intrate,intspeed=base:
|
intrate,intspeed=base:
|
||||||
EXTRA_COPTIMIZE = -fno-strict-aliasing
|
EXTRA_COPTIMIZE = -fno-strict-aliasing
|
||||||
LDCFLAGS = -z muldefs
|
LDCFLAGS = -z muldefs
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const argv = await yargs(hideBin(process.argv))
|
|||||||
})
|
})
|
||||||
.option('optimize-profile', {
|
.option('optimize-profile', {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
choices: ['O2', 'base'],
|
choices: ['O2', 'base', 'openmp'],
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
})
|
})
|
||||||
.option('allow-misaligned', {
|
.option('allow-misaligned', {
|
||||||
@@ -99,6 +99,12 @@ const optimizeProfiles = {
|
|||||||
"-O3",
|
"-O3",
|
||||||
"-flto=thin",
|
"-flto=thin",
|
||||||
],
|
],
|
||||||
|
openmp: [
|
||||||
|
"-O3",
|
||||||
|
"-flto=thin",
|
||||||
|
"-DSPEC_OPENMP",
|
||||||
|
"-fopenmp",
|
||||||
|
],
|
||||||
O2: [
|
O2: [
|
||||||
"-O2",
|
"-O2",
|
||||||
]
|
]
|
||||||
@@ -132,20 +138,25 @@ const specProc = await spawnSPECWithID(
|
|||||||
...argv.compilerSuite == "llvm" ? [sunway.mcpu(sunwayGeneration)] : [], // Only add -mcpu for llvm
|
...argv.compilerSuite == "llvm" ? [sunway.mcpu(sunwayGeneration)] : [], // Only add -mcpu for llvm
|
||||||
],
|
],
|
||||||
ldflags: [
|
ldflags: [
|
||||||
'-static',
|
|
||||||
`-L${path.resolve(prefix, 'lib')}`,
|
`-L${path.resolve(prefix, 'lib')}`,
|
||||||
...optimizeFlags,
|
...optimizeFlags,
|
||||||
"-fuse-ld=lld",
|
"-fuse-ld=lld",
|
||||||
...["--sysroot", sysroot],
|
...["--sysroot", sysroot],
|
||||||
...argv.optimizeProfile === "base" ? [
|
...["base", "openmp"].includes(argv.optimizeProfile) ? [
|
||||||
...argv.simd ? ["-Wl,-plugin-opt,-mattr=+simd"] : [],
|
...argv.simd ? ["-Wl,-plugin-opt,-mattr=+simd"] : [],
|
||||||
...argv.allowMisaligned ? [`-Wl,-plugin-opt,${sw64UnalignedFlag}`] : [],
|
...argv.allowMisaligned ? [`-Wl,-plugin-opt,${sw64UnalignedFlag}`] : [],
|
||||||
...sunwayGeneration === "8a" ? ["-Wl,-plugin-opt,-mattr=+core4"] : [],
|
...sunwayGeneration === "8a" ? ["-Wl,-plugin-opt,-mattr=+core4"] : [],
|
||||||
] : [],
|
] : [],
|
||||||
|
...argv.optimizeProfile === "openmp" ? [
|
||||||
|
`-Wl,-rpath=${argv.compilerPrefix}/lib`,
|
||||||
|
] : ['-static'],
|
||||||
],
|
],
|
||||||
compilerPaths: toolchain(argv.compilerPrefix, argv.compilerSuite as ToolchainSuite),
|
compilerPaths: toolchain(argv.compilerPrefix, argv.compilerSuite as ToolchainSuite),
|
||||||
libs: argv.compilerSuite === "llvm" ? cflangLibs(prefix) : [],
|
libs: (argv.compilerSuite === "llvm" || argv.compilerSuite !== "openmp") ? cflangLibs(prefix) : [],
|
||||||
specialFlags: getSpecialFlags(),
|
specialFlags: getSpecialFlags(),
|
||||||
|
openmp: {
|
||||||
|
threads: (argv.optimizeProfile === "openmp" ? 64 : 1),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setprocgroup: true,
|
setprocgroup: true,
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ export interface ConfigOptions {
|
|||||||
optimize: string[];
|
optimize: string[];
|
||||||
ldflags: string[];
|
ldflags: string[];
|
||||||
libs: string[];
|
libs: string[];
|
||||||
|
openmp: {
|
||||||
|
threads: number;
|
||||||
|
};
|
||||||
compilerPaths: {
|
compilerPaths: {
|
||||||
CXX: string,
|
CXX: string,
|
||||||
CC: string,
|
CC: string,
|
||||||
@@ -83,6 +86,7 @@ export const renderConfig = (options: ConfigOptions): string => {
|
|||||||
.replace("@@CompilerFC@@", options.compilerPaths.FC)
|
.replace("@@CompilerFC@@", options.compilerPaths.FC)
|
||||||
.replace("@@LIBS@@", options.libs.join(" "))
|
.replace("@@LIBS@@", options.libs.join(" "))
|
||||||
.replace("@@SpecialFlags@@", options.specialFlags)
|
.replace("@@SpecialFlags@@", options.specialFlags)
|
||||||
|
.replace("@@OpenMPThreads@@", options.openmp.threads.toString())
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user