1!{\src2tex{textfont=tt}} 2!!****f* ABINIT/xmpi_bcast_intv 3!! NAME 4!! xmpi_bcast_intv 5!! 6!! FUNCTION 7!! This module contains functions that calls MPI routine, 8!! if we compile the code using the MPI CPP flags. 9!! xmpi_bcast is the generic function. 10!! 11!! COPYRIGHT 12!! Copyright (C) 2001-2016 ABINIT group (Rshaltaf,AR,XG) 13!! This file is distributed under the terms of the 14!! GNU General Public License, see ~ABINIT/COPYING 15!! or http://www.gnu.org/copyleft/gpl.txt . 16!! 17!! SOURCE 18 19subroutine xmpi_bcast_intv(xval,master,spaceComm,ier) 20 21!This section has been created automatically by the script Abilint (TD). 22!Do not modify the following lines by hand. 23#undef ABI_FUNC 24#define ABI_FUNC 'xmpi_bcast_intv' 25!End of the abilint section 26 27 implicit none 28 29!Arguments------------------------- 30 integer,intent(inout) :: xval 31 integer,intent(in) :: spaceComm,master 32 integer,intent(out) :: ier 33 34! ************************************************************************* 35 36 ier=0 37#if defined HAVE_MPI 38 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 39 call MPI_BCAST(xval,1,MPI_INTEGER,master,spaceComm,ier) 40 end if 41#endif 42 43end subroutine xmpi_bcast_intv 44!!*** 45 46!!****f* ABINIT/xmpi_bcast_int1d 47!! NAME 48!! xmpi_bcast_int1d 49!! 50!! FUNCTION 51!! Broadcasts data from master to slaves. 52!! Target: one-dimensional integer arrays. 53!! 54!! INPUTS 55!! spaceComm= MPI communicator 56!! master= master MPI node 57!! 58!! OUTPUT 59!! ier= exit status, a non-zero value meaning there is an error 60!! 61!! SIDE EFFECTS 62!! xval= buffer array 63!! 64!! PARENTS 65!! 66!! CHILDREN 67!! mpi_bcast 68!! 69!! SOURCE 70subroutine xmpi_bcast_int1d(xval,master,spaceComm,ier) 71 72 73!This section has been created automatically by the script Abilint (TD). 74!Do not modify the following lines by hand. 75#undef ABI_FUNC 76#define ABI_FUNC 'xmpi_bcast_int1d' 77!End of the abilint section 78 79 implicit none 80 81!Arguments ------------------------------------ 82 integer, DEV_CONTARRD intent(inout) :: xval(:) 83 integer,intent(in) :: spaceComm,master 84 integer,intent(out) :: ier 85 86!Local variables------------------------------- 87 integer :: n 88 89! ************************************************************************* 90 91 ier=0 92#if defined HAVE_MPI 93 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 94 n=size(xval) 95 call MPI_BCAST(xval,n,MPI_INTEGER,master,spaceComm,ier) 96 end if 97#endif 98end subroutine xmpi_bcast_int1d 99!!*** 100 101!!****f* ABINIT/xmpi_bcast_int2d 102!! NAME 103!! xmpi_bcast_int2d 104!! 105!! FUNCTION 106!! Broadcasts data from master to slaves. 107!! Target: two-dimensional integer arrays. 108!! 109!! INPUTS 110!! spaceComm= MPI communicator 111!! master= master MPI node 112!! 113!! OUTPUT 114!! ier= exit status, a non-zero value meaning there is an error 115!! 116!! SIDE EFFECTS 117!! xval= buffer array 118!! 119!! PARENTS 120!! 121!! CHILDREN 122!! mpi_bcast 123!! 124!! SOURCE 125subroutine xmpi_bcast_int2d(xval,master,spaceComm,ier) 126 127 128!This section has been created automatically by the script Abilint (TD). 129!Do not modify the following lines by hand. 130#undef ABI_FUNC 131#define ABI_FUNC 'xmpi_bcast_int2d' 132!End of the abilint section 133 134 implicit none 135 136!Arguments------------------------- 137 integer, DEV_CONTARRD intent(inout) :: xval(:,:) 138 integer,intent(in) :: spaceComm,master 139 integer,intent(out) :: ier 140 141!Local variables------------------- 142#if defined HAVE_MPI 143 integer :: n1,n2 144#endif 145 146! ************************************************************************* 147 148 ier=0 149#if defined HAVE_MPI 150 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 151 n1=size(xval,dim=1) 152 n2=size(xval,dim=2) 153 call MPI_BCAST(xval,n1*n2,MPI_INTEGER,master,spaceComm,ier) 154 end if 155#endif 156 157end subroutine xmpi_bcast_int2d 158!!*** 159 160!!****f* ABINIT/xmpi_bcast_int3d 161!! NAME 162!! xmpi_bcast_int3d 163!! 164!! FUNCTION 165!! Broadcasts data from master to slaves. 166!! Target: three-dimensional integer arrays. 167!! 168!! INPUTS 169!! spaceComm= MPI communicator 170!! master= master MPI node 171!! 172!! OUTPUT 173!! ier= exit status, a non-zero value meaning there is an error 174!! 175!! SIDE EFFECTS 176!! xval= buffer array 177!! 178!! PARENTS 179!! 180!! CHILDREN 181!! mpi_bcast 182!! 183!! SOURCE 184subroutine xmpi_bcast_int3d(xval,master,spaceComm,ier) 185 186 187 188!This section has been created automatically by the script Abilint (TD). 189!Do not modify the following lines by hand. 190#undef ABI_FUNC 191#define ABI_FUNC 'xmpi_bcast_int3d' 192!End of the abilint section 193 194 implicit none 195 196!Arguments------------------------- 197 integer, DEV_CONTARRD intent(inout) :: xval(:,:,:) 198 integer,intent(in) :: spaceComm,master 199 integer,intent(out) :: ier 200 201!Local variables------------------------------- 202#if defined HAVE_MPI 203 integer :: n1,n2,n3 204#endif 205 206! ************************************************************************* 207 208 ier=0 209#if defined HAVE_MPI 210 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 211 n1=size(xval,dim=1) 212 n2=size(xval,dim=2) 213 n3=size(xval,dim=3) 214 call MPI_BCAST(xval,n1*n2*n3,MPI_INTEGER,master,spaceComm,ier) 215 end if 216#endif 217end subroutine xmpi_bcast_int3d 218!!*** 219 220!!****f* ABINIT/xmpi_bcast_dpv 221!! NAME 222!! xmpi_bcast_dpv 223!! 224!! FUNCTION 225!! Broadcasts data from master to slaves. 226!! Target: scalar double precisions. 227!! 228!! INPUTS 229!! spaceComm= MPI communicator 230!! master= master MPI node 231!! 232!! OUTPUT 233!! ier= exit status, a non-zero value meaning there is an error 234!! 235!! SIDE EFFECTS 236!! xval= buffer array 237!! 238!! PARENTS 239!! 240!! CHILDREN 241!! mpi_bcast 242!! 243!! SOURCE 244 245subroutine xmpi_bcast_dpv(xval,master,spaceComm,ier) 246 247 248 249!This section has been created automatically by the script Abilint (TD). 250!Do not modify the following lines by hand. 251#undef ABI_FUNC 252#define ABI_FUNC 'xmpi_bcast_dpv' 253!End of the abilint section 254 255 implicit none 256 257!Arguments ------------------------------------ 258 real(dp),intent(inout) :: xval 259 integer ,intent(in) :: spaceComm,master 260 integer ,intent(out) :: ier 261!Local variables------------------------------- 262 263! ************************************************************************* 264 265 ier=0 266#if defined HAVE_MPI 267 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 268 call MPI_BCAST(xval,1,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 269 end if 270#endif 271 272end subroutine xmpi_bcast_dpv 273!!*** 274 275!!****f* ABINIT/xmpi_bcast_dp1d 276!! NAME 277!! xmpi_bcast_dp1d 278!! 279!! FUNCTION 280!! Broadcasts data from master to slaves. 281!! Target: double precision one-dimensional arrays. 282!! 283!! INPUTS 284!! spaceComm= MPI communicator 285!! master= master MPI node 286!! 287!! OUTPUT 288!! ier= exit status, a non-zero value meaning there is an error 289!! 290!! SIDE EFFECTS 291!! xval= buffer array 292!! 293!! PARENTS 294!! 295!! CHILDREN 296!! mpi_bcast 297!! 298!! SOURCE 299subroutine xmpi_bcast_dp1d(xval,master,spaceComm,ier) 300 301 302 303!This section has been created automatically by the script Abilint (TD). 304!Do not modify the following lines by hand. 305#undef ABI_FUNC 306#define ABI_FUNC 'xmpi_bcast_dp1d' 307!End of the abilint section 308 309 implicit none 310 311!Arguments------------------------- 312 real(dp), DEV_CONTARRD intent(inout) :: xval(:) 313 integer ,intent(in) :: spaceComm,master 314 integer ,intent(out) :: ier 315 316!Local variables------------------- 317#if defined HAVE_MPI 318 integer :: n 319#endif 320 321! ************************************************************************* 322 323 ier=0 324#if defined HAVE_MPI 325 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 326 n=size(xval,dim=1) 327 call MPI_BCAST(xval,n,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 328 end if 329#endif 330 331end subroutine xmpi_bcast_dp1d 332!!*** 333 334!!****f* ABINIT/xmpi_bcast_dp2d 335!! NAME 336!! xmpi_bcast_dp2d 337!! 338!! FUNCTION 339!! Broadcasts data from master to slaves. 340!! Target: double precision two-dimensional arrays. 341!! 342!! INPUTS 343!! spaceComm= MPI communicator 344!! master= master MPI node 345!! 346!! OUTPUT 347!! ier= exit status, a non-zero value meaning there is an error 348!! 349!! SIDE EFFECTS 350!! xval= buffer array 351!! 352!! SOURCE 353 354subroutine xmpi_bcast_dp2d(xval,master,spaceComm,ier) 355 356!This section has been created automatically by the script Abilint (TD). 357!Do not modify the following lines by hand. 358#undef ABI_FUNC 359#define ABI_FUNC 'xmpi_bcast_dp2d' 360!End of the abilint section 361 362 implicit none 363 364!Arguments------------------------- 365 real(dp), DEV_CONTARRD intent(inout) :: xval(:,:) 366 integer ,intent(in) :: spaceComm,master 367 integer ,intent(out) :: ier 368 369!Local variables------------------- 370#if defined HAVE_MPI 371 integer :: n1,n2 372#endif 373 374! ************************************************************************* 375 376 ier=0 377#if defined HAVE_MPI 378 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 379 n1=size(xval,dim=1) 380 n2=size(xval,dim=2) 381 call MPI_BCAST(xval,n1*n2,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 382 end if 383#endif 384 385end subroutine xmpi_bcast_dp2d 386!!*** 387 388!!****f* ABINIT/xmpi_bcast_dp3d 389!! NAME 390!! xmpi_bcast_dp3d 391!! 392!! FUNCTION 393!! Broadcasts data from master to slaves. 394!! Target: double precision three-dimensional arrays. 395!! 396!! INPUTS 397!! spaceComm= MPI communicator 398!! master= master MPI node 399!! 400!! OUTPUT 401!! ier= exit status, a non-zero value meaning there is an error 402!! 403!! SIDE EFFECTS 404!! xval= buffer array 405!! 406!! SOURCE 407 408subroutine xmpi_bcast_dp3d(xval,master,spaceComm,ier) 409 410 411 412!This section has been created automatically by the script Abilint (TD). 413!Do not modify the following lines by hand. 414#undef ABI_FUNC 415#define ABI_FUNC 'xmpi_bcast_dp3d' 416!End of the abilint section 417 418 implicit none 419 420!Arguments------------------------- 421 real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:) 422 integer ,intent(in) :: spaceComm,master 423 integer ,intent(out) :: ier 424 425!Local variables------------------- 426#if defined HAVE_MPI 427 integer :: n1,n2,n3 428#endif 429 430! ************************************************************************* 431 432 ier=0 433#if defined HAVE_MPI 434 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 435 n1=size(xval,dim=1) 436 n2=size(xval,dim=2) 437 n3=size(xval,dim=3) 438 call MPI_BCAST(xval,n1*n2*n3,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 439 end if 440#endif 441 442end subroutine xmpi_bcast_dp3d 443!!*** 444 445!!****f* ABINIT/xmpi_bcast_dp4d 446!! NAME 447!! xmpi_bcast_dp4d 448!! 449!! FUNCTION 450!! Broadcasts data from master to slaves. 451!! Target: double precision four-dimensional arrays. 452!! 453!! INPUTS 454!! spaceComm= MPI communicator 455!! master= master MPI node 456!! 457!! OUTPUT 458!! ier= exit status, a non-zero value meaning there is an error 459!! 460!! SIDE EFFECTS 461!! xval= buffer array 462!! 463!! SOURCE 464 465subroutine xmpi_bcast_dp4d(xval,master,spaceComm,ier) 466 467!This section has been created automatically by the script Abilint (TD). 468!Do not modify the following lines by hand. 469#undef ABI_FUNC 470#define ABI_FUNC 'xmpi_bcast_dp4d' 471!End of the abilint section 472 473 implicit none 474 475!Arguments------------------------- 476 real(dp), DEV_CONTARRD intent(inout) :: xval(:,:,:,:) 477 integer ,intent(in) :: spaceComm,master 478 integer ,intent(out) :: ier 479 480!Local variables------------------- 481#if defined HAVE_MPI 482 integer :: n1,n2,n3,n4 483#endif 484 485! ************************************************************************* 486 487 ier=0 488#if defined HAVE_MPI 489 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 490 n1=size(xval,dim=1) 491 n2=size(xval,dim=2) 492 n3=size(xval,dim=3) 493 n4=size(xval,dim=4) 494 call MPI_BCAST(xval,n1*n2*n3*n4,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 495 end if 496#endif 497 498end subroutine xmpi_bcast_dp4d 499!!*** 500 501!!****f* ABINIT/xmpi_bcast_spv 502!! NAME 503!! xmpi_bcast_spv 504!! 505!! FUNCTION 506!! Broadcasts data from master to slaves. 507!! Target: scalar single precisions. 508!! 509!! INPUTS 510!! spaceComm= MPI communicator 511!! master= master MPI node 512!! 513!! OUTPUT 514!! ier= exit status, a non-zero value meaning there is an error 515!! 516!! SIDE EFFECTS 517!! xval= buffer array 518!! 519!! SOURCE 520 521subroutine xmpi_bcast_spv(xval,master,spaceComm,ier) 522 523 524!This section has been created automatically by the script Abilint (TD). 525!Do not modify the following lines by hand. 526#undef ABI_FUNC 527#define ABI_FUNC 'xmpi_bcast_spv' 528!End of the abilint section 529 530implicit none 531 532 533!Arguments------------------------- 534 real(sp),intent(inout) :: xval 535 integer,intent(in) :: spaceComm,master 536 integer,intent(out) :: ier 537 538! ************************************************************************* 539 540 ier=0 541#if defined HAVE_MPI 542 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 543 call MPI_BCAST(xval,1,MPI_REAL,master,spaceComm,ier) 544 end if 545#endif 546 547end subroutine xmpi_bcast_spv 548!!*** 549 550!!****f* ABINIT/xmpi_bcast_sp1d 551!! NAME 552!! xmpi_bcast_sp1d 553!! 554!! FUNCTION 555!! Broadcasts data from master to slaves. 556!! Target: one-dimensional single precision arrays. 557!! 558!! INPUTS 559!! spaceComm= MPI communicator 560!! master= master MPI node 561!! 562!! OUTPUT 563!! ier= exit status, a non-zero value meaning there is an error 564!! 565!! SIDE EFFECTS 566!! xval= buffer array 567!! 568!! SOURCE 569 570subroutine xmpi_bcast_sp1d(xval,master,spaceComm,ier) 571 572 573!This section has been created automatically by the script Abilint (TD). 574!Do not modify the following lines by hand. 575#undef ABI_FUNC 576#define ABI_FUNC 'xmpi_bcast_sp1d' 577!End of the abilint section 578 579 implicit none 580 581!Arguments------------------------- 582 real(sp), DEV_CONTARRD intent(inout) :: xval(:) 583 integer ,intent(in) :: spaceComm,master 584 integer ,intent(out) :: ier 585 586!Local variables------------------- 587#if defined HAVE_MPI 588 integer :: n 589#endif 590 591! ************************************************************************* 592 593 ier=0 594#if defined HAVE_MPI 595 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 596 n=size(xval,dim=1) 597 call MPI_BCAST(xval,n,MPI_REAL,master,spaceComm,ier) 598 end if 599#endif 600 601end subroutine xmpi_bcast_sp1d 602!!*** 603 604!!****f* ABINIT/xmpi_bcast_sp2d 605!! NAME 606!! xmpi_bcast_sp2d 607!! 608!! FUNCTION 609!! Broadcasts data from master to slaves. 610!! Target: two-dimensional single precision arrays. 611!! 612!! INPUTS 613!! spaceComm= MPI communicator 614!! master= master MPI node 615!! 616!! OUTPUT 617!! ier= exit status, a non-zero value meaning there is an error 618!! 619!! SIDE EFFECTS 620!! xval= buffer array 621!! 622!! SOURCE 623 624subroutine xmpi_bcast_sp2d(xval,master,spaceComm,ier) 625 626 627 628!This section has been created automatically by the script Abilint (TD). 629!Do not modify the following lines by hand. 630#undef ABI_FUNC 631#define ABI_FUNC 'xmpi_bcast_sp2d' 632!End of the abilint section 633 634 implicit none 635 636!Arguments------------------------- 637 real(sp), DEV_CONTARRD intent(inout) :: xval(:,:) 638 integer ,intent(in) :: spaceComm,master 639 integer ,intent(out) :: ier 640 641!Local variables------------------- 642#if defined HAVE_MPI 643 integer :: n1,n2 644#endif 645 646! ************************************************************************* 647 648 ier=0 649#if defined HAVE_MPI 650 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 651 n1=size(xval,dim=1) 652 n2=size(xval,dim=2) 653 call MPI_BCAST(xval,n1*n2,MPI_REAL,master,spaceComm,ier) 654 end if 655#endif 656 657end subroutine xmpi_bcast_sp2d 658!!*** 659 660!!****f* ABINIT/xmpi_bcast_sp3d 661!! NAME 662!! xmpi_bcast_sp3d 663!! 664!! FUNCTION 665!! Broadcasts data from master to slaves. 666!! Target: three-dimensional single precision arrays. 667!! 668!! INPUTS 669!! spaceComm= MPI communicator 670!! master= master MPI node 671!! 672!! OUTPUT 673!! ier= exit status, a non-zero value meaning there is an error 674!! 675!! SIDE EFFECTS 676!! xval= buffer array 677!! 678!! SOURCE 679 680subroutine xmpi_bcast_sp3d(xval,master,spaceComm,ier) 681 682 683 684!This section has been created automatically by the script Abilint (TD). 685!Do not modify the following lines by hand. 686#undef ABI_FUNC 687#define ABI_FUNC 'xmpi_bcast_sp3d' 688!End of the abilint section 689 690 implicit none 691 692!Arguments------------------------- 693 real(sp), DEV_CONTARRD intent(inout) :: xval(:,:,:) 694 integer ,intent(in) :: spaceComm,master 695 integer ,intent(out) :: ier 696 697!Local variables------------------- 698#if defined HAVE_MPI 699 integer :: n1,n2,n3 700#endif 701 702! ************************************************************************* 703 704 ier=0 705#if defined HAVE_MPI 706 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 707 n1=size(xval,dim=1) 708 n2=size(xval,dim=2) 709 n3=size(xval,dim=3) 710 call MPI_BCAST(xval,n1*n2*n3,MPI_REAL,master,spaceComm,ier) 711 end if 712#endif 713 714end subroutine xmpi_bcast_sp3d 715!!*** 716 717!!****f* ABINIT/xmpi_bcast_sp4d 718!! NAME 719!! xmpi_bcast_sp4d 720!! 721!! FUNCTION 722!! Broadcasts data from master to slaves. 723!! Target: four-dimensional single precision arrays. 724!! 725!! INPUTS 726!! spaceComm= MPI communicator 727!! master= master MPI node 728!! 729!! OUTPUT 730!! ier= exit status, a non-zero value meaning there is an error 731!! 732!! SIDE EFFECTS 733!! xval= buffer array 734!! 735!! SOURCE 736 737subroutine xmpi_bcast_sp4d(xval,master,spaceComm,ier) 738 739 740 741!This section has been created automatically by the script Abilint (TD). 742!Do not modify the following lines by hand. 743#undef ABI_FUNC 744#define ABI_FUNC 'xmpi_bcast_sp4d' 745!End of the abilint section 746 747 implicit none 748 749!Arguments------------------------- 750 real(sp), DEV_CONTARRD intent(inout) :: xval(:,:,:,:) 751 integer ,intent(in) :: spaceComm,master 752 integer ,intent(out) :: ier 753 754!Local variables------------------- 755#if defined HAVE_MPI 756 integer :: n1,n2,n3,n4 757#endif 758 759! ************************************************************************* 760 761 ier=0 762#if defined HAVE_MPI 763 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 764 n1=size(xval,dim=1) 765 n2=size(xval,dim=2) 766 n3=size(xval,dim=3) 767 n4=size(xval,dim=4) 768 call MPI_BCAST(xval,n1*n2*n3*n4,MPI_REAL,master,spaceComm,ier) 769 end if 770#endif 771 772end subroutine xmpi_bcast_sp4d 773!!*** 774 775!!****f* ABINIT/xmpi_bcast_cplxv 776!! NAME 777!! xmpi_bcast_cplxv 778!! 779!! FUNCTION 780!! Broadcasts data from master to slaves. 781!! Target: scalar complexs. 782!! 783!! INPUTS 784!! spaceComm= MPI communicator 785!! master= master MPI node 786!! 787!! OUTPUT 788!! ier= exit status, a non-zero value meaning there is an error 789!! 790!! SIDE EFFECTS 791!! xval= buffer array 792!! 793!! PARENTS 794!! 795!! CHILDREN 796!! mpi_bcast 797!! 798!! SOURCE 799subroutine xmpi_bcast_cplxv(xval,master,spaceComm,ier) 800 801 802 803!This section has been created automatically by the script Abilint (TD). 804!Do not modify the following lines by hand. 805#undef ABI_FUNC 806#define ABI_FUNC 'xmpi_bcast_cplxv' 807!End of the abilint section 808 809implicit none 810 811!Arguments------------------------- 812 complex(spc),intent(inout) :: xval 813 integer ,intent(in) :: spaceComm,master 814 integer ,intent(out) :: ier 815 816!Local variables------------------- 817 818! ************************************************************************* 819 820 ier=0 821#if defined HAVE_MPI 822 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 823 call MPI_BCAST(xval,1,MPI_COMPLEX,master,spaceComm,ier) 824 end if 825#endif 826 827end subroutine xmpi_bcast_cplxv 828!!*** 829 830!!****f* ABINIT/xmpi_bcast_cplx1d 831!! NAME 832!! xmpi_bcast_cplx1d 833!! 834!! FUNCTION 835!! Broadcasts data from master to slaves. 836!! Target: one-dimensional complex arrays. 837!! 838!! INPUTS 839!! spaceComm= MPI communicator 840!! master= master MPI node 841!! 842!! OUTPUT 843!! ier= exit status, a non-zero value meaning there is an error 844!! 845!! SIDE EFFECTS 846!! xval= buffer array 847!! 848!! PARENTS 849!! 850!! CHILDREN 851!! mpi_bcast 852!! 853!! SOURCE 854subroutine xmpi_bcast_cplx1d(xval,master,spaceComm,ier) 855 856 857 858!This section has been created automatically by the script Abilint (TD). 859!Do not modify the following lines by hand. 860#undef ABI_FUNC 861#define ABI_FUNC 'xmpi_bcast_cplx1d' 862!End of the abilint section 863 864implicit none 865 866!Arguments------------------------- 867 complex(spc), DEV_CONTARRD intent(inout) :: xval(:) 868 integer ,intent(in) :: spaceComm,master 869 integer ,intent(out) :: ier 870 871!Local variables------------------- 872#if defined HAVE_MPI 873 integer :: n 874#endif 875 876! ************************************************************************* 877 878 ier=0 879#if defined HAVE_MPI 880 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 881 n=size(xval(:)) 882 call MPI_BCAST(xval,n,MPI_COMPLEX,master,spaceComm,ier) 883 end if 884#endif 885 886end subroutine xmpi_bcast_cplx1d 887!!*** 888 889!!****f* ABINIT/xmpi_bcast_cplx2d 890!! NAME 891!! xmpi_bcast_cplx2d 892!! 893!! FUNCTION 894!! Broadcasts data from master to slaves. 895!! Target: two-dimensional complex arrays. 896!! 897!! INPUTS 898!! spaceComm= MPI communicator 899!! master= master MPI node 900!! 901!! OUTPUT 902!! ier= exit status, a non-zero value meaning there is an error 903!! 904!! SIDE EFFECTS 905!! xval= buffer array 906!! 907!! SOURCE 908 909subroutine xmpi_bcast_cplx2d(xval,master,spaceComm,ier) 910 911!This section has been created automatically by the script Abilint (TD). 912!Do not modify the following lines by hand. 913#undef ABI_FUNC 914#define ABI_FUNC 'xmpi_bcast_cplx2d' 915!End of the abilint section 916 917implicit none 918 919!Arguments------------------------- 920 complex(spc), DEV_CONTARRD intent(inout) :: xval(:,:) 921 integer ,intent(in) :: spaceComm,master 922 integer ,intent(out) :: ier 923 924!Local variables------------------- 925#if defined HAVE_MPI 926 integer :: n1,n2 927#endif 928 929! ************************************************************************* 930 931 ier=0 932#if defined HAVE_MPI 933 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 934 n1=size(xval,dim=1) 935 n2=size(xval,dim=2) 936 call MPI_BCAST(xval,n1*n2,MPI_COMPLEX,master,spaceComm,ier) 937 end if 938#endif 939 940end subroutine xmpi_bcast_cplx2d 941!!*** 942 943!!****f* ABINIT/xmpi_bcast_cplx3d 944!! NAME 945!! xmpi_bcast_cplx3d 946!! 947!! FUNCTION 948!! Broadcasts data from master to slaves. 949!! Target: three-dimensional complex arrays. 950!! 951!! INPUTS 952!! spaceComm= MPI communicator 953!! master= master MPI node 954!! 955!! OUTPUT 956!! ier= exit status, a non-zero value meaning there is an error 957!! 958!! SIDE EFFECTS 959!! xval= buffer array 960!! 961!! SOURCE 962 963subroutine xmpi_bcast_cplx3d(xval,master,spaceComm,ier) 964 965 966 967!This section has been created automatically by the script Abilint (TD). 968!Do not modify the following lines by hand. 969#undef ABI_FUNC 970#define ABI_FUNC 'xmpi_bcast_cplx3d' 971!End of the abilint section 972 973implicit none 974 975!Arguments------------------------- 976 complex(spc), DEV_CONTARRD intent(inout) :: xval(:,:,:) 977 integer ,intent(in) :: spaceComm,master 978 integer ,intent(out) :: ier 979 980!Local variables------------------- 981#if defined HAVE_MPI 982 integer :: n1,n2,n3 983#endif 984 985! ************************************************************************* 986 987 ier=0 988#if defined HAVE_MPI 989 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 990 n1=size(xval,dim=1) 991 n2=size(xval,dim=2) 992 n3=size(xval,dim=3) 993 call MPI_BCAST(xval,n1*n2*n3,MPI_COMPLEX,master,spaceComm,ier) 994 end if 995#endif 996 997end subroutine xmpi_bcast_cplx3d 998!!*** 999 1000!!****f* ABINIT/xmpi_bcast_cplx4d 1001!! NAME 1002!! xmpi_bcast_cplx4d 1003!! 1004!! FUNCTION 1005!! Broadcasts data from master to slaves. 1006!! Target: four-dimensional complex arrays. 1007!! 1008!! INPUTS 1009!! spaceComm= MPI communicator 1010!! master= master MPI node 1011!! 1012!! OUTPUT 1013!! ier= exit status, a non-zero value meaning there is an error 1014!! 1015!! SIDE EFFECTS 1016!! xval= buffer array 1017!! 1018!! SOURCE 1019subroutine xmpi_bcast_cplx4d(xval,master,spaceComm,ier) 1020 1021!This section has been created automatically by the script Abilint (TD). 1022!Do not modify the following lines by hand. 1023#undef ABI_FUNC 1024#define ABI_FUNC 'xmpi_bcast_cplx4d' 1025!End of the abilint section 1026 1027 implicit none 1028 1029!Arguments------------------------- 1030 complex(spc), DEV_CONTARRD intent(inout) :: xval(:,:,:,:) 1031 integer ,intent(in) :: spaceComm,master 1032 integer ,intent(out) :: ier 1033 1034!Local variables------------------- 1035#if defined HAVE_MPI 1036 integer :: n1,n2,n3,n4 1037#endif 1038 1039! ************************************************************************* 1040 1041 ier=0 1042#if defined HAVE_MPI 1043 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1044 n1=size(xval,dim=1) 1045 n2=size(xval,dim=2) 1046 n3=size(xval,dim=3) 1047 n4=size(xval,dim=4) 1048 call MPI_BCAST(xval,n1*n2*n3*n4,MPI_COMPLEX,master,spaceComm,ier) 1049 end if 1050#endif 1051 1052end subroutine xmpi_bcast_cplx4d 1053!!*** 1054 1055!!****f* ABINIT/xmpi_bcast_dcv 1056!! NAME 1057!! xmpi_bcast_dcv 1058!! 1059!! FUNCTION 1060!! Broadcasts data from master to slaves. 1061!! Target: scalar double complexs. 1062!! 1063!! INPUTS 1064!! spaceComm= MPI communicator 1065!! master= master MPI node 1066!! 1067!! OUTPUT 1068!! ier= exit status, a non-zero value meaning there is an error 1069!! 1070!! SIDE EFFECTS 1071!! xval= buffer array 1072!! 1073!! SOURCE 1074 1075subroutine xmpi_bcast_dcv(xval,master,spaceComm,ier) 1076 1077 1078 1079!This section has been created automatically by the script Abilint (TD). 1080!Do not modify the following lines by hand. 1081#undef ABI_FUNC 1082#define ABI_FUNC 'xmpi_bcast_dcv' 1083!End of the abilint section 1084 1085implicit none 1086 1087!Arguments------------------------- 1088 complex(dpc),intent(inout):: xval 1089 integer ,intent(in) :: spaceComm,master 1090 integer ,intent(out) :: ier 1091 1092! ************************************************************************* 1093 1094 ier=0 1095#if defined HAVE_MPI 1096 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1097 call MPI_BCAST(xval,1,MPI_DOUBLE_COMPLEX,master,spaceComm,ier) 1098 end if 1099#endif 1100 1101end subroutine xmpi_bcast_dcv 1102!!*** 1103 1104!!****f* ABINIT/xmpi_bcast_dc1d 1105!! NAME 1106!! xmpi_bcast_dc1d 1107!! 1108!! FUNCTION 1109!! Broadcasts data from master to slaves. 1110!! Target: one-dimensional double complex arrays. 1111!! 1112!! INPUTS 1113!! spaceComm= MPI communicator 1114!! master= master MPI node 1115!! 1116!! OUTPUT 1117!! ier= exit status, a non-zero value meaning there is an error 1118!! 1119!! SIDE EFFECTS 1120!! xval= buffer array 1121!! 1122!! SOURCE 1123 1124subroutine xmpi_bcast_dc1d(xval,master,spaceComm,ier) 1125 1126 1127!This section has been created automatically by the script Abilint (TD). 1128!Do not modify the following lines by hand. 1129#undef ABI_FUNC 1130#define ABI_FUNC 'xmpi_bcast_dc1d' 1131!End of the abilint section 1132 1133implicit none 1134 1135!Arguments------------------------- 1136 complex(dpc), DEV_CONTARRD intent(inout):: xval(:) 1137 integer ,intent(in) :: spaceComm,master 1138 integer ,intent(out) :: ier 1139 1140!Local variables------------------- 1141#if defined HAVE_MPI 1142 integer :: n 1143#endif 1144 1145! ************************************************************************* 1146 1147 ier=0 1148#if defined HAVE_MPI 1149 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1150 n=size(xval(:)) 1151 call MPI_BCAST(xval,n,MPI_DOUBLE_COMPLEX,master,spaceComm,ier) 1152 end if 1153#endif 1154 1155end subroutine xmpi_bcast_dc1d 1156!!*** 1157 1158!!****f* ABINIT/xmpi_bcast_dc2d 1159!! NAME 1160!! xmpi_bcast_dc2d 1161!! 1162!! FUNCTION 1163!! Broadcasts data from master to slaves. 1164!! Target: two-dimensional double complex arrays. 1165!! 1166!! INPUTS 1167!! spaceComm= MPI communicator 1168!! master= master MPI node 1169!! 1170!! OUTPUT 1171!! ier= exit status, a non-zero value meaning there is an error 1172!! 1173!! SIDE EFFECTS 1174!! xval= buffer array 1175!! 1176!! 1177!! SOURCE 1178 1179subroutine xmpi_bcast_dc2d(xval,master,spaceComm,ier) 1180 1181!This section has been created automatically by the script Abilint (TD). 1182!Do not modify the following lines by hand. 1183#undef ABI_FUNC 1184#define ABI_FUNC 'xmpi_bcast_dc2d' 1185!End of the abilint section 1186 1187implicit none 1188 1189!Arguments------------------------- 1190 complex(dpc), DEV_CONTARRD intent(inout):: xval(:,:) 1191 integer ,intent(in) :: spaceComm,master 1192 integer ,intent(out) :: ier 1193 1194!Local variables------------------- 1195#if defined HAVE_MPI 1196 integer :: n1,n2 1197#endif 1198 1199! ************************************************************************* 1200 1201 ier=0 1202#if defined HAVE_MPI 1203 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1204 n1=size(xval,dim=1) 1205 n2=size(xval,dim=2) 1206 call MPI_BCAST(xval,n1*n2,MPI_DOUBLE_COMPLEX,master,spaceComm,ier) 1207 end if 1208#endif 1209 1210end subroutine xmpi_bcast_dc2d 1211!!*** 1212 1213!!****f* ABINIT/xmpi_bcast_dc3d 1214!! NAME 1215!! xmpi_bcast_dc3d 1216!! 1217!! FUNCTION 1218!! Broadcasts data from master to slaves. 1219!! Target: three-dimensional double complex arrays. 1220!! 1221!! INPUTS 1222!! spaceComm= MPI communicator 1223!! master= master MPI node 1224!! 1225!! OUTPUT 1226!! ier= exit status, a non-zero value meaning there is an error 1227!! 1228!! SIDE EFFECTS 1229!! xval= buffer array 1230!! 1231!! SOURCE 1232 1233subroutine xmpi_bcast_dc3d(xval,master,spaceComm,ier) 1234 1235!This section has been created automatically by the script Abilint (TD). 1236!Do not modify the following lines by hand. 1237#undef ABI_FUNC 1238#define ABI_FUNC 'xmpi_bcast_dc3d' 1239!End of the abilint section 1240 1241implicit none 1242 1243 1244!Arguments------------------------- 1245 complex(dpc), DEV_CONTARRD intent(inout):: xval(:,:,:) 1246 integer ,intent(in) :: spaceComm,master 1247 integer ,intent(out) :: ier 1248 1249!Local variables------------------- 1250#if defined HAVE_MPI 1251 integer :: n1,n2,n3 1252#endif 1253 1254! ************************************************************************* 1255 1256 ier=0 1257#if defined HAVE_MPI 1258 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1259 n1=size(xval,dim=1) 1260 n2=size(xval,dim=2) 1261 n3=size(xval,dim=3) 1262 call MPI_BCAST(xval,n1*n2*n3,MPI_DOUBLE_COMPLEX,master,spaceComm,ier) 1263 end if 1264#endif 1265 1266end subroutine xmpi_bcast_dc3d 1267!!*** 1268 1269!!****f* ABINIT/xmpi_bcast_dc4d 1270!! NAME 1271!! xmpi_bcast_dc4d 1272!! 1273!! FUNCTION 1274!! Broadcasts data from master to slaves. 1275!! Target: four-dimensional complex arrays in double precision. 1276!! 1277!! INPUTS 1278!! spaceComm= MPI communicator 1279!! master= master MPI node 1280!! 1281!! OUTPUT 1282!! ier= exit status, a non-zero value meaning there is an error 1283!! 1284!! SIDE EFFECTS 1285!! xval= buffer array 1286!! 1287!! SOURCE 1288 1289subroutine xmpi_bcast_dc4d(xval,master,spaceComm,ier) 1290 1291!This section has been created automatically by the script Abilint (TD). 1292!Do not modify the following lines by hand. 1293#undef ABI_FUNC 1294#define ABI_FUNC 'xmpi_bcast_dc4d' 1295!End of the abilint section 1296 1297implicit none 1298 1299!Arguments------------------------- 1300 complex(dpc), DEV_CONTARRD intent(inout) :: xval(:,:,:,:) 1301 integer,intent(in) :: spaceComm,master 1302 integer,intent(out) :: ier 1303 1304!Local variables------------------- 1305#if defined HAVE_MPI 1306 integer :: n1,n2,n3,n4 1307#endif 1308 1309! ************************************************************************* 1310 1311 ier=0 1312#if defined HAVE_MPI 1313 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1314 n1=size(xval,dim=1) 1315 n2=size(xval,dim=2) 1316 n3=size(xval,dim=3) 1317 n4=size(xval,dim=4) 1318 call MPI_BCAST(xval,n1*n2*n3*n4,MPI_DOUBLE_COMPLEX,master,spaceComm,ier) 1319 end if 1320#endif 1321 1322end subroutine xmpi_bcast_dc4d 1323!!*** 1324 1325!!****f* ABINIT/xmpi_bcast_ch0d 1326!! NAME 1327!! xmpi_bcast_ch0d 1328!! 1329!! FUNCTION 1330!! Broadcasts data from master to slaves. 1331!! Target: character strings. 1332!! 1333!! INPUTS 1334!! spaceComm= MPI communicator 1335!! master= master MPI node 1336!! 1337!! OUTPUT 1338!! ier= exit status, a non-zero value meaning there is an error 1339!! 1340!! SIDE EFFECTS 1341!! xval= buffer array 1342!! 1343!! SOURCE 1344 1345subroutine xmpi_bcast_ch0d(xval,master,spaceComm,ier) 1346 1347!This section has been created automatically by the script Abilint (TD). 1348!Do not modify the following lines by hand. 1349#undef ABI_FUNC 1350#define ABI_FUNC 'xmpi_bcast_ch0d' 1351!End of the abilint section 1352 1353 implicit none 1354 1355!Arguments------------------------- 1356 character(len=*),intent(inout) :: xval 1357 integer,intent(in) :: spaceComm,master 1358 integer,intent(out) :: ier 1359 1360!Local variables------------------------------- 1361#if defined HAVE_MPI 1362 integer :: nch,rank 1363#endif 1364 1365!************************************************************************* 1366 1367 ier=0 1368#if defined HAVE_MPI 1369 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1370 call MPI_COMM_RANK(spaceComm,rank,ier) 1371 if (rank==master) nch=len_trim(xval) 1372 call MPI_BCAST(nch,1,MPI_INTEGER,master,spaceComm,ier) 1373 call MPI_BCAST(xval,nch,MPI_CHARACTER,master,spaceComm,ier) 1374 if (rank/=master) xval(nch+1:)='' 1375 end if 1376#endif 1377 1378end subroutine xmpi_bcast_ch0d 1379!!*** 1380 1381!!****f* ABINIT/xmpi_bcast_ch1d 1382!! NAME 1383!! xmpi_bcast_ch1d 1384!! 1385!! FUNCTION 1386!! Broadcasts data from master to slaves. 1387!! Target: one-dimensional array of character stringss. 1388!! 1389!! INPUTS 1390!! spaceComm= MPI communicator 1391!! master= master MPI node 1392!! 1393!! OUTPUT 1394!! ier= exit status, a non-zero value meaning there is an error 1395!! 1396!! SIDE EFFECTS 1397!! xval= buffer array 1398!! 1399!! SOURCE 1400subroutine xmpi_bcast_ch1d(xval,master,spaceComm,ier) 1401 1402!This section has been created automatically by the script Abilint (TD). 1403!Do not modify the following lines by hand. 1404#undef ABI_FUNC 1405#define ABI_FUNC 'xmpi_bcast_ch1d' 1406!End of the abilint section 1407 1408 implicit none 1409 1410!Arguments------------------------- 1411 Character(len=*), DEV_CONTARRD intent(inout) :: xval(:) 1412 integer,intent(in) :: spaceComm,master 1413 integer,intent(out) :: ier 1414 1415!Local variables------------------------------- 1416#if defined HAVE_MPI 1417 integer :: ii,nch 1418#endif 1419 1420!************************************************************************* 1421 1422 ier=0 1423#if defined HAVE_MPI 1424 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1425 nch=0 1426 do ii=1,size(xval) 1427 nch=nch+len(xval(ii)) 1428 end do 1429 call MPI_BCAST(xval,nch,MPI_CHARACTER,master,spaceComm,ier) 1430 end if 1431#endif 1432 1433end subroutine xmpi_bcast_ch1d 1434!!*** 1435 1436 1437!!****f* ABINIT/xmpi_bcast_log0d 1438!! NAME 1439!! xmpi_bcast_log0d 1440!! 1441!! FUNCTION 1442!! Broadcasts data from master to slaves. 1443!! Target: logical scalar 1444!! 1445!! INPUTS 1446!! spaceComm= MPI communicator 1447!! master= master MPI node 1448!! 1449!! OUTPUT 1450!! ier= exit status, a non-zero value meaning there is an error 1451!! 1452!! SOURCE 1453 1454subroutine xmpi_bcast_log0d(xval,master,spaceComm,ier) 1455 1456 1457 1458!This section has been created automatically by the script Abilint (TD). 1459!Do not modify the following lines by hand. 1460#undef ABI_FUNC 1461#define ABI_FUNC 'xmpi_bcast_log0d' 1462!End of the abilint section 1463 1464 implicit none 1465 1466!Arguments------------------------- 1467 logical,intent(inout) :: xval 1468 integer,intent(in) :: spaceComm,master 1469 integer,intent(out) :: ier 1470 1471! ************************************************************************* 1472 1473 ier=0 1474#if defined HAVE_MPI 1475 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1476 call MPI_BCAST(xval,1,MPI_LOGICAL,master,spaceComm,ier) 1477 end if 1478#endif 1479 1480end subroutine xmpi_bcast_log0d 1481!!*** 1482 1483!!****f* ABINIT/xmpi_bcast_coeffi2_1d 1484!! NAME 1485!! xmpi_bcast_coeffi2_1d 1486!! 1487!! FUNCTION 1488!! Broadcasts data from master to slaves. 1489!! Target: type(coeffi2) 1D-arrays. 1490!! 1491!! INPUTS 1492!! spaceComm= MPI communicator 1493!! master= master MPI node 1494!! 1495!! OUTPUT 1496!! ier= exit status, a non-zero value meaning there is an error 1497!! 1498!! SIDE EFFECTS 1499!! xval= buffer array 1500!! 1501!! SOURCE 1502 1503subroutine xmpi_bcast_coeffi2_1d(xval,master,spaceComm,ier) 1504 1505!This section has been created automatically by the script Abilint (TD). 1506!Do not modify the following lines by hand. 1507#undef ABI_FUNC 1508#define ABI_FUNC 'xmpi_bcast_coeffi2_1d' 1509!End of the abilint section 1510 1511 implicit none 1512 1513!Arguments------------------------- 1514 type(coeffi2_type), intent(inout) :: xval(:) 1515 integer ,intent(in) :: spaceComm,master 1516 integer ,intent(out) :: ier 1517 1518!Local variables------------------- 1519#if defined HAVE_MPI 1520 integer :: ii,jj,kk,me,n0,n1,n2,siztot 1521 integer,allocatable :: mpibuf(:),siz(:,:) 1522#endif 1523 1524! ************************************************************************* 1525 1526 ier=0 1527#if defined HAVE_MPI 1528 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1529 me=xmpi_comm_rank(spaceComm) 1530 1531! Broadcast xval%value sizes 1532 n0=size(xval) 1533 ABI_STAT_ALLOCATE(siz,(2,n0), ier) 1534 if (ier/= 0) call xmpi_abort(msg='error allocating siz in xmpi_bcast') 1535 if (me==master) then 1536 do ii=1,n0 1537 siz(1,ii)=size(xval(ii)%value,1) 1538 siz(2,ii)=size(xval(ii)%value,2) 1539 end do 1540 end if 1541 call MPI_BCAST(siz,2*n0,MPI_INTEGER,master,spaceComm,ier) 1542 siztot=0 1543 do ii=1,n0 1544 siztot=siztot+siz(1,ii)*siz(2,ii) 1545 end do 1546 1547! Fill in the buffer 1548 ABI_STAT_ALLOCATE(mpibuf,(siztot), ier) 1549 if (ier/= 0) call xmpi_abort(msg='error allocating mpibuf in xmpi_bcast') 1550 if (me==master) then 1551 jj=0 1552 do ii=1,n0 1553 n1=siz(1,ii);n2=siz(2,ii) 1554 do kk=1,n2 1555 mpibuf(jj+1:jj+n1)=xval(ii)%value(1:n1,kk) 1556 jj=jj+n1 1557 end do 1558 end do 1559 end if 1560 1561! Broadcast the data 1562 call MPI_BCAST(mpibuf,siztot,MPI_INTEGER,master,spaceComm,ier) 1563 1564! Retrieve the buffer 1565 jj=0 1566 do ii=1,n0 1567 n1=siz(1,ii);n2=siz(2,ii) 1568 if (.not.allocated(xval(ii)%value)) then 1569 ABI_STAT_ALLOCATE(xval(ii)%value,(n1,n2), ier) 1570 if (ier/= 0) call xmpi_abort(msg='error allocating xval%value in xmpi_bcast') 1571 end if 1572 do kk=1,n2 1573 xval(ii)%value(1:n1,kk)=mpibuf(jj+1:jj+n1) 1574 jj=jj+n1 1575 end do 1576 end do 1577 ABI_DEALLOCATE(siz) 1578 ABI_DEALLOCATE(mpibuf) 1579 1580 end if 1581#endif 1582 1583end subroutine xmpi_bcast_coeffi2_1d 1584!!*** 1585 1586!!****f* ABINIT/xmpi_bcast_coeff2_1d 1587!! NAME 1588!! xmpi_bcast_coeff2_1d 1589!! 1590!! FUNCTION 1591!! Broadcasts data from master to slaves. 1592!! Target: type(coeff2) 1D-arrays. 1593!! 1594!! INPUTS 1595!! spaceComm= MPI communicator 1596!! master= master MPI node 1597!! 1598!! OUTPUT 1599!! ier= exit status, a non-zero value meaning there is an error 1600!! 1601!! SIDE EFFECTS 1602!! xval= buffer array 1603!! 1604!! SOURCE 1605 1606subroutine xmpi_bcast_coeff2_1d(xval,master,spaceComm,ier) 1607 1608!This section has been created automatically by the script Abilint (TD). 1609!Do not modify the following lines by hand. 1610#undef ABI_FUNC 1611#define ABI_FUNC 'xmpi_bcast_coeff2_1d' 1612!End of the abilint section 1613 1614 implicit none 1615 1616!Arguments------------------------- 1617 type(coeff2_type), intent(inout) :: xval(:) 1618 integer ,intent(in) :: spaceComm,master 1619 integer ,intent(out) :: ier 1620 1621!Local variables------------------- 1622#if defined HAVE_MPI 1623 integer :: ii,jj,kk,me,n0,n1,n2,siztot 1624 integer,allocatable :: siz(:,:) 1625 real(dp),allocatable :: mpibuf(:) 1626#endif 1627 1628! ************************************************************************* 1629 1630 ier=0 1631#if defined HAVE_MPI 1632 if (spaceComm /= MPI_COMM_SELF .and. spaceComm /= MPI_COMM_NULL) then 1633 me=xmpi_comm_rank(spaceComm) 1634 1635! Broadcast xval%value sizes 1636 n0=size(xval) 1637 ABI_STAT_ALLOCATE(siz,(2,n0), ier) 1638 if (ier/= 0) call xmpi_abort(msg='error allocating siz in xmpi_bcast') 1639 if (me==master) then 1640 do ii=1,n0 1641 siz(1,ii)=size(xval(ii)%value,1) 1642 siz(2,ii)=size(xval(ii)%value,2) 1643 end do 1644 end if 1645 call MPI_BCAST(siz,2*n0,MPI_INTEGER,master,spaceComm,ier) 1646 siztot=0 1647 do ii=1,n0 1648 siztot=siztot+siz(1,ii)*siz(2,ii) 1649 end do 1650 1651! Fill in the buffer 1652 ABI_STAT_ALLOCATE(mpibuf,(siztot), ier) 1653 if (ier/= 0) call xmpi_abort(msg='error allocating mpibuf in xmpi_bcast') 1654 if (me==master) then 1655 jj=0 1656 do ii=1,n0 1657 n1=siz(1,ii);n2=siz(2,ii) 1658 do kk=1,n2 1659 mpibuf(jj+1:jj+n1)=xval(ii)%value(1:n1,kk) 1660 jj=jj+n1 1661 end do 1662 end do 1663 end if 1664 1665! Broadcast the data 1666 call MPI_BCAST(mpibuf,siztot,MPI_DOUBLE_PRECISION,master,spaceComm,ier) 1667 1668! Retrieve the buffer 1669 jj=0 1670 do ii=1,n0 1671 n1=siz(1,ii);n2=siz(2,ii) 1672 if (.not.allocated(xval(ii)%value)) then 1673 ABI_STAT_ALLOCATE(xval(ii)%value,(n1,n2), ier) 1674 if (ier/= 0) call xmpi_abort(msg='error allocating xval%value in xmpi_bcast') 1675 end if 1676 do kk=1,n2 1677 xval(ii)%value(1:n1,kk)=mpibuf(jj+1:jj+n1) 1678 jj=jj+n1 1679 end do 1680 end do 1681 ABI_DEALLOCATE(siz) 1682 ABI_DEALLOCATE(mpibuf) 1683 1684 end if 1685#endif 1686 1687end subroutine xmpi_bcast_coeff2_1d 1688!!*** 1689 1690