The performance of a parallel program depends largely on its data partitions. So a good data partitioning scheme is the need of the time. However it is very difficult to arrive at a good solution as the number of possible data partitions for a given real life program is exponential in the size of the program. We present a heuristic technique for automatic data partitioning for HPF. Our approach is based on genetic algorithms and is very simple, yet very efficient to quickly find appropriate data partitions even for large programs with large number of alternatives for data distribution. It makes use of both static as well as dynamic data distribution with the main aim of reducing the overall execution time of the entire program.