我将Mac OS与CLion IDE结合使用,我的任务是同时使用两个并行库(Open MP和MPI)。
问题是
module.exports.hello = async event => {
return {
statusCode: 200,
body: JSON.stringify(
{
message: 'Go Serverless v1.0! Your function executed successfully!',
input: event,
},
null,
2
),
};
};
我认为我无法弄清楚如何为其编写正确的CMakeLists。
我的CMakeLists如下:
Undefined symbols for architecture x86_64:
"_MPI_Init", referenced from:
_main in main.c.o
ld: symbol(s) not found for architecture x86_64
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
由于“偏好设置”中的C编译器是
cmake_minimum_required(VERSION 3.15.3)
project(SeqSol C)
set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++")
set(OPENMP_LIBRARIES "/usr/local/opt/llvm/lib")
set(OPENMP_INCLUDES "/usr/local/opt/llvm/include")
OPTION(USE_OpenMP "Use OpenMP to enable <omp.h>" ON)
OPTION(USE_MPI "Use MPI to enable <mpi.h>" ON)
# Find OpenMP
if (APPLE AND USE_OpenMP)
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp9")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp9_LIBRARY ${OpenMP_C_LIB_NAMES})
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp9")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp9_LIBRARY ${OpenMP_CXX_LIB_NAMES})
endif ()
endif ()
if (USE_OpenMP)
find_package(OpenMP REQUIRED)
endif (USE_OpenMP)
if (USE_MPI)
find_package(MPI REQUIRED)
endif (USE_MPI)
if (MPI_FOUND)
include_directories(${MPI_INCLUDES_PATH})
link_directories(${MPI_LIBRARIES_PATH})
endif(MPI_FOUND)
if (OPENMP_FOUND)
include_directories("${OPENMP_INCLUDES}")
link_directories("${OPENMP_LIBRARIES}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif (OPENMP_FOUND)
add_executable(SeqSol main.c problem.c fileparse.c)
我也写了CMake选项:
/usr/local/opt/llvm/bin/clang
我可以使用Open MP功能,但是对于MPI来说是不可能的。
有什么建议吗?
答案 0 :(得分:1)
我终于弄清楚了如何混合打开mp和mpi。此CMake文件对我有用
try:
from tkinter import *
except ImportError:
from Tkinter import *
try:
import tkinter.ttk as ttk
py3 = 1
except ImportError:
import ttk
py3 = 0
def create_window():
global root, top
root = Tk() # creating a tkinter window, Tk is a class
top = MainFrame(root) # building the gui, so it's like MainFrame is inheriting the Tk class
root.mainloop() # infinite main loop
class MainFrame:
def __init__(self, top=None):
self.style = ttk.Style()
if sys.platform == "win32":
self.style.theme_use('winnative')
top.geometry("802x557+250+104")
top.minsize(120, 1)
top.maxsize(2970, 881)
top.resizable(0, 0) # fixing the GUI size
self.Labelframe = LabelFrame(top)
self.Labelframe.place(relx=0.4, rely=0.4, relheight=0.279, relwidth=0.264)
self.Labelframe.configure(text='''Test label''', background="#d9d9d9")
if __name__ == '__main__':
create_window()