Created
October 4, 2025 03:21
-
-
Save codedeep79/32aa57af06133f86c5470a8282791c6d to your computer and use it in GitHub Desktop.
Chương trình demo bằng Fortran sau khi cài Intel oneAPI Fortran Compiler (ifort / ifx).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| program demo_oneapi | |
| implicit none | |
| integer, parameter :: n = 500 | |
| real(8), dimension(n,n) :: A, B, C | |
| integer :: i, j, k | |
| real(8) :: start_time, end_time | |
| ! Khởi tạo ma trận A, B | |
| do i = 1, n | |
| do j = 1, n | |
| A(i,j) = dble(i + j) | |
| B(i,j) = dble(i - j) | |
| end do | |
| end do | |
| C = 0.0d0 | |
| print *, "=======================================" | |
| print *, " 🚀 Demo Intel oneAPI Fortran Compiler " | |
| print *, "=======================================" | |
| print *, "Hello Intel oneAPI from Fortran!" | |
| print *, "Thực hiện nhân ma trận kích thước ", n, "x", n | |
| call cpu_time(start_time) | |
| ! Nhân ma trận C = A * B | |
| do i = 1, n | |
| do j = 1, n | |
| do k = 1, n | |
| C(i,j) = C(i,j) + A(i,k) * B(k,j) | |
| end do | |
| end do | |
| end do | |
| call cpu_time(end_time) | |
| print *, "✅ Hoàn thành nhân ma trận." | |
| print *, "⏱️ Thời gian chạy (giây): ", end_time - start_time | |
| print *, "Ví dụ kết quả: C(1,1) = ", C(1,1) | |
| print *, "=======================================" | |
| end program demo_oneapi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment