准备提交

This commit is contained in:
yly 2026-01-22 04:30:04 +08:00
parent 4291d88e3b
commit 08e8addef1
No known key found for this signature in database
5 changed files with 14 additions and 13 deletions

0
buildall.sh Normal file → Executable file
View File

View File

@ -1,12 +1,10 @@
add_rules("mode.debug", "mode.release")
add_requires("openmp")
-- OpenMP Hello World
target("openmp_hello_world")
set_kind("binary")
add_files("openmp_hello_world.c")
add_cflags("-fopenmp", {force = true})
add_ldflags("-fopenmp", {force = true})
add_packages("openmp")
-- PI Serial (中值积分)
target("pi")
set_kind("binary")
@ -16,8 +14,7 @@ target("pi")
target("pi_par")
set_kind("binary")
add_files("pi_par.c")
add_cflags("-fopenmp", {force = true})
add_ldflags("-fopenmp", {force = true})
add_packages("openmp")
-- PI Monte Carlo Serial
target("pimonte_serial")
@ -28,8 +25,7 @@ target("pimonte_serial")
target("pimonte_par")
set_kind("binary")
add_files("pimonte_par.c")
add_cflags("-fopenmp", {force = true})
add_ldflags("-fopenmp", {force = true})
add_packages("openmp")
--
-- If you want to known more usage about xmake, please see https://xmake.io

View File

@ -10,6 +10,10 @@ target("count_words_par")
add_files("count_words_par.c")
add_links("pthread")
target("count_words_par_opt")
set_kind("binary")
add_files("count_words_par_opt.c")
add_links("pthread")
target("count_words_ser")
set_kind("binary")
add_files("count_words_ser.c")

View File

@ -109,7 +109,7 @@ for N in "${N_VALUES[@]}"; do
echo -n "Running with $P process(es)... "
# Run the program and capture output
OUTPUT=$(mpirun --oversubscribe --hostfile ~/mpi_hosts -np $P ./build/linux/$BUILD_ARCH/release/prime_par_naive $N $(echo "$N/$P" | bc) 2>&1)
OUTPUT=$(mpirun --oversubscribe --hostfile ~/mpi_hosts -np $P ./build/linux/$BUILD_ARCH/release/prime_par $N $(echo "$N/$P" | bc) 2>&1)
# Extract prime count and time from output
PRIME_COUNT=$(echo "$OUTPUT" | grep "Between" | grep -oP '\d+(?= primes)')

View File

@ -1,5 +1,6 @@
set_project("gemm")
set_version("1.0")
add_requires("openmp")
add_rules("mode.debug", "mode.release")
-- Find MPI package
@ -15,8 +16,8 @@ target("gemm_serial")
target("gemm_parallel")
set_kind("binary")
add_files("gemm_parallel.cpp")
add_cxxflags("-O3", "-march=native", "-fopenmp")
add_ldflags("-fopenmp")
add_cxxflags("-O3", "-march=native")
add_packages("openmp")
-- 使用mpic++作为编译器
add_packages("mpi")
add_packages("mpi_cxx")
@ -25,8 +26,8 @@ target("gemm_parallel")
target("gemm_optimized")
set_kind("binary")
add_files("gemm_optimized.cpp")
add_cxxflags("-O3", "-march=native", "-fopenmp")
add_ldflags("-fopenmp")
add_cxxflags("-O3", "-march=native")
add_packages("openmp")
-- 使用mpic++作为编译器
add_packages("mpi")
add_packages("mpi_cxx")